Improve error reporting.
This commit is contained in:
14
src/test/res/ids.lua
Normal file
14
src/test/res/ids.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
-- utility to give tables and functions uniform ids for testing
|
||||
ids = {}
|
||||
function id(obj)
|
||||
if not obj or type(obj) == 'number' or type(obj) == 'string' or type(obj) == 'boolean' then
|
||||
return obj
|
||||
end
|
||||
local v = ids[obj]
|
||||
if v then
|
||||
return v
|
||||
end
|
||||
table.insert(ids,obj)
|
||||
ids[obj] = type(obj)..'.'..tostring(#ids)
|
||||
return ids[obj]
|
||||
end
|
||||
Reference in New Issue
Block a user