hump icon indicating copy to clipboard operation
hump copied to clipboard

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

Open sysl-dev opened this issue 5 years ago • 1 comments

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 avatar Oct 17 '19 04:10 sysl-dev

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

sysl-dev avatar Oct 18 '19 00:10 sysl-dev