aboutsummaryrefslogtreecommitdiff
path: root/src/lua/audio/luaopen_Source.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-07-31 12:19:22 +0800
committerchai <chaifix@163.com>2018-07-31 12:19:22 +0800
commita5bb008eb554daf26f55b5fe43b0fa12ffb15973 (patch)
tree1eac93471b855ef878d3fd6a4614cfacb1ea6464 /src/lua/audio/luaopen_Source.cpp
parent7ac86950d3a89a996974e8406ee88e8f5f44187d (diff)
*update
Diffstat (limited to 'src/lua/audio/luaopen_Source.cpp')
-rw-r--r--src/lua/audio/luaopen_Source.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lua/audio/luaopen_Source.cpp b/src/lua/audio/luaopen_Source.cpp
index 0b8391a..d147e5e 100644
--- a/src/lua/audio/luaopen_Source.cpp
+++ b/src/lua/audio/luaopen_Source.cpp
@@ -84,7 +84,16 @@ namespace lua
return 0;
}
+ static int l_gc(lua_State* L)
+ {
+ SDLSource* src = checkSource(L);
+ src->stop();
+ delete src;
+ return 0;
+ }
+
static const luaL_Reg f[] = {
+ { "__gc", l_gc },
{ "play", l_play },
{ "stop", l_stop },
{ "pause", l_pause },