mirror of
https://github.com/fortressforever/fortressforever-scripts.git
synced 2024-11-10 15:22:07 +00:00
Merge pull request #29 from fortressforever/fix-class_info
Don't crash if class_info() is called on non-luabind objects
This commit is contained in:
commit
4dac32dcf9
1 changed files with 14 additions and 0 deletions
|
@ -48,6 +48,20 @@ function baseclass:new (o)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
-- make luabind's class_info function safer
|
||||||
|
-- (don't crash if class_info() is called on non-luabind objects)
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
local class_info_base = class_info
|
||||||
|
class_info = function(obj)
|
||||||
|
local obj_type = type(obj)
|
||||||
|
if obj_type == "userdata" and getmetatable(obj).__luabind_class then
|
||||||
|
return class_info_base(obj)
|
||||||
|
end
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- reset everything
|
-- reset everything
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue