diff options
Diffstat (limited to 'Sluift/Lua')
-rw-r--r-- | Sluift/Lua/LuaUtils.cpp | 11 | ||||
-rw-r--r-- | Sluift/Lua/LuaUtils.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/Sluift/Lua/LuaUtils.cpp b/Sluift/Lua/LuaUtils.cpp index 2192689..915f3cc 100644 --- a/Sluift/Lua/LuaUtils.cpp +++ b/Sluift/Lua/LuaUtils.cpp @@ -32,6 +32,17 @@ void Swift::Lua::registerTableToString(lua_State* L, int index) { lua_pop(L, 1); } +void Swift::Lua::registerTableEquals(lua_State* L, int index) { + index = Lua::absoluteOffset(L, index); + lua_rawgeti(L, LUA_REGISTRYINDEX, Sluift::globals.coreLibIndex); + lua_getfield(L, -1, "register_table_equals"); + lua_pushvalue(L, index); + if (lua_pcall(L, 1, 0, 0) != 0) { + throw Lua::Exception(lua_tostring(L, -1)); + } + lua_pop(L, 1); +} + void Swift::Lua::registerGetByTypeIndex(lua_State* L, int index) { index = Lua::absoluteOffset(L, index); lua_rawgeti(L, LUA_REGISTRYINDEX, Sluift::globals.coreLibIndex); diff --git a/Sluift/Lua/LuaUtils.h b/Sluift/Lua/LuaUtils.h index 19ab74e..105f249 100644 --- a/Sluift/Lua/LuaUtils.h +++ b/Sluift/Lua/LuaUtils.h @@ -23,6 +23,7 @@ namespace Swift { int convertTableToString(lua_State* L); void registerTableToString(lua_State* L, int index); + void registerTableEquals(lua_State* L, int index); void registerGetByTypeIndex(lua_State* L, int index); void registerHelp(lua_State* L, int index, const std::string& description, const std::string& parameters, const std::string& options); |