Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hump.signal - crashes when sending "clear", "remove" or any other signals that share a name with a Registry function name. #118

Open
sysl-dev opened this issue Oct 17, 2019 · 1 comment

Comments

@sysl-dev
Copy link

signal.emit("clear")

Error: library/hump/signal.lua:42: bad argument #1 to 'pairs' (table expected, got function)

function Registry:emit(s, ...)
	for f in pairs(self[s]) do
		f(...)
	end
end

Registry:emit does not check if self[s] is a function before trying to read it like a table.

@sysl-dev
Copy link
Author

This is the patch I'm using:

function Registry:emit(s, ...)
	if type(self[s]) == "function" then
		print("HUMP Signal:", "This would have crashed hump signal.")
	else
	for f in pairs(self[s]) do
		f(...)
	end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant