added function which checks is x an object

This commit is contained in:
Parki 2016-02-05 23:30:37 +10:00
parent bffb00b195
commit 64f2219d3f

View File

@ -175,4 +175,18 @@ end
setmetatable(middleclass, { __call = function(_, ...) return middleclass.class(...) end })
function isObject(obj)
if type(obj) == 'table' then
local a = getmetatable(obj)
if a then
return a['initialize'] ~= nil
else
return false
end
else
return false
end
end
return middleclass