Files
luaj/src/test/res/ids.lua

15 lines
336 B
Lua
Raw Normal View History

2007-12-06 15:29:49 +00:00
-- 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