mirror of
https://github.com/kikito/middleclass.git
synced 2024-11-25 02:44:20 +00:00
added function which checks is x an object
This commit is contained in:
parent
bffb00b195
commit
64f2219d3f
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user