diff options
Diffstat (limited to 'src/scripting/luautil.h')
-rw-r--r-- | src/scripting/luautil.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/scripting/luautil.h b/src/scripting/luautil.h index 8bcc2a30..f2b76896 100644 --- a/src/scripting/luautil.h +++ b/src/scripting/luautil.h @@ -106,6 +106,11 @@ public: #else luaL_setfuncs(s, members, 0); #endif + + // Make the functions table available as a global + lua_pushvalue(s, -1); // metatable, "__index", {}, {} + lua_setglobal(s, mTypeName); // metatable, "__index", {} + lua_rawset(s, -3); // metatable lua_pop(s, 1); // -empty- } @@ -230,7 +235,7 @@ void pushSTLContainer(lua_State *s, const std::list<T> &container) { push(s, *i); lua_rawseti(s, table, key); - i++; + ++i; } } @@ -264,7 +269,7 @@ void pushSTLContainer(lua_State *s, const std::map<Tkey, Tval> &container) push(s, i->first); push(s, i->second); lua_settable(s, table); - i++; + ++i; } } @@ -282,7 +287,7 @@ void pushSTLContainer(lua_State *s, const std::set<T> &container) { push(s, *i); lua_rawseti(s, table, key); - i++; + ++i; } } |