diff options
Diffstat (limited to 'src/script/graphics/luaopen_Image.cpp')
-rw-r--r-- | src/script/graphics/luaopen_Image.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/script/graphics/luaopen_Image.cpp b/src/script/graphics/luaopen_Image.cpp index 7b9b96a..9506ce4 100644 --- a/src/script/graphics/luaopen_Image.cpp +++ b/src/script/graphics/luaopen_Image.cpp @@ -11,7 +11,10 @@ namespace lua static inline Image* checkImage(lua_State* L) { - return (Image*)luax_checktype(L, 1, TYPE_IMAGE); + Proxy* proxy = (Proxy*)luax_checktype(L, 1, TYPE_IMAGE); + if (proxy != 0 && proxy != nullptr) + return (Image*)proxy->object; + return nullptr; } static int l_getWidth(lua_State* L) @@ -60,7 +63,9 @@ namespace lua static int l_gc(lua_State* L) { - + Image* i = checkImage(L); + if (i != nullptr) + delete i; return 0; } |