From 33e6b9627e6a46d388d46f2c5b4d15ba7e9f9904 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 18 Oct 2017 21:34:55 -0400 Subject: Started refactoring * Finished a basic server * Changed from ZMQ to nanomsg (basically the same though) * Moved some repeated code from the client/server directories into "shared" * Edited makefile to reflect new dependencies --- src/shared/lua_api/common.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/shared/lua_api/common.c (limited to 'src/shared/lua_api/common.c') diff --git a/src/shared/lua_api/common.c b/src/shared/lua_api/common.c new file mode 100644 index 0000000..1e0c971 --- /dev/null +++ b/src/shared/lua_api/common.c @@ -0,0 +1,38 @@ + +extern "C" { + #include + #include + #include +} + +#include "common.h" + +//Expose things to the lua state +void loadLLibs(lua_State* L){ + + lua_pushcfunction(L,luaopen_base); + lua_pushliteral(L,""); + lua_call(L,1,0); + + lua_pushcfunction(L,luaopen_table); + lua_pushliteral(L,LUA_TABLIBNAME); + lua_call(L,1,0); + + lua_pushcfunction(L,luaopen_string); + lua_pushliteral(L,LUA_STRLIBNAME); + lua_call(L,1,0); + + lua_pushcfunction(L,luaopen_math); + lua_pushliteral(L,LUA_MATHLIBNAME); + lua_call(L,1,0); + + lua_pushcfunction(L,luaopen_string); + lua_pushliteral(L,LUA_STRLIBNAME); + lua_call(L,1,0); + + /* + lua_pushcfunction(L,luaopen_string); + lua_pushliteral(L,LUA_STRLIBNAME); + lua_call(L,1,0); + */ +} -- cgit v1.2.3-70-g09d2