diff --git a/rsc/scripts/setup_server.lua b/rsc/scripts/setup_server.lua index afbac57..d11bc07 100644 --- a/rsc/scripts/setup_server.lua +++ b/rsc/scripts/setup_server.lua @@ -26,6 +26,12 @@ print("Lua script check") +entityAPI = require("entity") + +for k, v in pairs(entityAPI) do + print(k, v) +end + --requirements roomManagerAPI = require("room_manager") roomAPI = require("room") @@ -114,3 +120,4 @@ roomAPI.Initialize(underworld, mapSaver.Load, mapSaver.Save, mapMaker.DebugGrass --call the monstrosity doorUtility.CreateDoorPair("pair 1", overworld, -64, -64, underworld, 64, 64) + diff --git a/server/characters/character_api.cpp b/server/characters/character_api.cpp index 04ed563..2873c27 100644 --- a/server/characters/character_api.cpp +++ b/server/characters/character_api.cpp @@ -102,27 +102,27 @@ static const luaL_Reg characterLib[] = { }; LUAMOD_API int openCharacterAPI(lua_State* L) { - //get the parent table - luaL_requiref(L, TORTUGA_ENTITY_API, openEntityAPI, false); - //the local table luaL_newlib(L, characterLib); - //merge the local table into the parent table + //get the parent table + luaL_requiref(L, TORTUGA_ENTITY_API, openEntityAPI, false); + + //merge the parent table into the local table lua_pushnil(L); //first key while(lua_next(L, -2)) { //copy the key-value pair lua_pushvalue(L, -2); lua_pushvalue(L, -2); - //push the copy to the parent table + //push the copy to the local table lua_settable(L, -6); //pop the original value before continuing lua_pop(L, 1); } - //remove the local table, leaving the expanded parent table + //remove the parent table, leaving the expanded local table lua_pop(L, 1); return 1; diff --git a/server/combat/barrier_api.cpp b/server/combat/barrier_api.cpp index 069d6bf..207f35e 100644 --- a/server/combat/barrier_api.cpp +++ b/server/combat/barrier_api.cpp @@ -75,27 +75,27 @@ static const luaL_Reg barrierLib[] = { }; LUAMOD_API int openBarrierAPI(lua_State* L) { - //get the parent table - luaL_requiref(L, TORTUGA_ENTITY_API, openEntityAPI, false); - //the local table luaL_newlib(L, barrierLib); - //merge the local table into the parent table + //get the parent table + luaL_requiref(L, TORTUGA_ENTITY_API, openEntityAPI, false); + + //merge the parent table into the local table lua_pushnil(L); //first key while(lua_next(L, -2)) { //copy the key-value pair lua_pushvalue(L, -2); lua_pushvalue(L, -2); - //push the copy to the parent table + //push the copy to the local table lua_settable(L, -6); //pop the original value before continuing lua_pop(L, 1); } - //remove the local table, leaving the expanded parent table + //remove the parent table, leaving the expanded local table lua_pop(L, 1); return 1; diff --git a/server/creatures/creature_api.cpp b/server/creatures/creature_api.cpp index 67b3f91..a12724d 100644 --- a/server/creatures/creature_api.cpp +++ b/server/creatures/creature_api.cpp @@ -76,27 +76,27 @@ static const luaL_Reg creatureLib[] = { }; LUAMOD_API int openCreatureAPI(lua_State* L) { - //get the parent table - luaL_requiref(L, TORTUGA_ENTITY_API, openEntityAPI, false); - //the local table luaL_newlib(L, creatureLib); - //merge the local table into the parent table + //get the parent table + luaL_requiref(L, TORTUGA_ENTITY_API, openEntityAPI, false); + + //merge the parent table into the local table lua_pushnil(L); //first key while(lua_next(L, -2)) { //copy the key-value pair lua_pushvalue(L, -2); lua_pushvalue(L, -2); - //push the copy to the parent table + //push the copy to the local table lua_settable(L, -6); //pop the original value before continuing lua_pop(L, 1); } - //remove the local table, leaving the expanded parent table + //remove the parent table, leaving the expanded local table lua_pop(L, 1); return 1;