diff options
Diffstat (limited to 'src/script/graphics')
-rw-r--r-- | src/script/graphics/luaopen_Canvas.cpp | 6 | ||||
-rw-r--r-- | src/script/graphics/luaopen_Image.cpp | 6 | ||||
-rw-r--r-- | src/script/graphics/luaopen_JSL.cpp | 8 |
3 files changed, 9 insertions, 11 deletions
diff --git a/src/script/graphics/luaopen_Canvas.cpp b/src/script/graphics/luaopen_Canvas.cpp index a34e3b3..1e22772 100644 --- a/src/script/graphics/luaopen_Canvas.cpp +++ b/src/script/graphics/luaopen_Canvas.cpp @@ -50,9 +50,9 @@ namespace lua static int l_gc(lua_State* L) { - Canvas* canvas = checkCanvas(L); - if (canvas != nullptr) - delete canvas; + Proxy* proxy = (Proxy*)luax_checktype(L, 1, TYPE_CANVAS); + Canvas* canvas = (Canvas*)proxy->object; + delete canvas; return 0; } diff --git a/src/script/graphics/luaopen_Image.cpp b/src/script/graphics/luaopen_Image.cpp index 9506ce4..246ea09 100644 --- a/src/script/graphics/luaopen_Image.cpp +++ b/src/script/graphics/luaopen_Image.cpp @@ -63,9 +63,9 @@ namespace lua static int l_gc(lua_State* L) { - Image* i = checkImage(L); - if (i != nullptr) - delete i; + Proxy* proxy = (Proxy*)luax_checktype(L, 1, TYPE_IMAGE); + Image* img = (Image*)proxy->object; + delete img; return 0; } diff --git a/src/script/graphics/luaopen_JSL.cpp b/src/script/graphics/luaopen_JSL.cpp index 33afa2c..919949c 100644 --- a/src/script/graphics/luaopen_JSL.cpp +++ b/src/script/graphics/luaopen_JSL.cpp @@ -121,11 +121,9 @@ namespace lua static int l_gc(lua_State* L) { - JSLProgram* jsl = checkJSLProgram(L); - if (jsl != nullptr && jsl != NULL) - { - delete jsl; - } + Proxy* proxy = (Proxy*)luax_checktype(L, 1, TYPE_JSL); + JSLProgram* jsl = (JSLProgram*)proxy->object; + delete jsl; return 0; } |