diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-21 11:43:44 +0200 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-21 11:43:44 +0200 |
commit | 0b68859a8d428b2af44828c716f80e46450b1b08 (patch) | |
tree | 0f3df2b8cd4464d45ae447b42a9cc716488cb44c /crawl-ref/source/clua.cc | |
parent | 7974b1cb0ff0b1d4e20550a3bc731b5c7df7ed10 (diff) | |
download | crawl-ref-0b68859a8d428b2af44828c716f80e46450b1b08.tar.gz crawl-ref-0b68859a8d428b2af44828c716f80e46450b1b08.zip |
Move clua_register_metatable to cluautil.
Diffstat (limited to 'crawl-ref/source/clua.cc')
-rw-r--r-- | crawl-ref/source/clua.cc | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc index 5c15de7389..334b481319 100644 --- a/crawl-ref/source/clua.cc +++ b/crawl-ref/source/clua.cc @@ -653,31 +653,6 @@ void CLua::remove_shutdown_listener(lua_shutdown_listener *listener) shutdown_listeners.erase(i); } -///////////////////////////////////////////////////////////////////// - -void clua_register_metatable(lua_State *ls, const char *tn, - const luaL_reg *lr, - int (*gcfn)(lua_State *ls)) -{ - lua_stack_cleaner clean(ls); - luaL_newmetatable(ls, tn); - lua_pushstring(ls, "__index"); - lua_pushvalue(ls, -2); - lua_settable(ls, -3); - - if (gcfn) - { - lua_pushstring(ls, "__gc"); - lua_pushcfunction(ls, gcfn); - lua_settable(ls, -3); - } - - if (lr) - { - luaL_openlib(ls, NULL, lr, 0); - } -} - //////////////////////////////////////////////////////////////////////// // lua_text_pattern |