diff options
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/main.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/server/main.cpp b/src/server/main.cpp index 17fd535..94e0dbd 100644 --- a/src/server/main.cpp +++ b/src/server/main.cpp @@ -23,6 +23,7 @@ extern "C" { #include "../shared/lua_api/common.h" #include "../shared/lua_api/load_net.hpp" +#include "../shared/lua_api/load_phys.hpp" #include "../shared/phys/physcommon.hpp" using namespace std; @@ -38,9 +39,13 @@ int main (){ printf("Brok[en]gine Server\n"); L = luaL_newstate(); + lua_newtable(L); + lua_setglobal(L,"GAME"); + phys_genesis(); loadLLibs(L); loadNetLibs(L); + loadPhysLibs(L); int iErr = luaL_dofile(L,"../data/init.lua"); if(iErr != 0){ lua_error(L); @@ -49,6 +54,14 @@ int main (){ do{ gameloop(); std::this_thread::yield(); + lua_getglobal(L,"GAME");//{} + lua_getfield(L,-1,"tick");//{},function_tick() + if(!lua_isnil(L,-1)){ + lua_call(L,0,0); + lua_pop(L,1); + }else{ + lua_pop(L,2); + } }while(true); phys_shutdown(NULL); |
