#include "lualib.h"
#include "lauxlib.c"
+extern void luaopen_cobra(lua_State *);
static lua_State *mush_lua_env = NULL;
static lua_CFunction mlua_notify(lua_State *);
void mlua_test(dbref);
mush_lua_env = lua_open();
+ /* Load MUSH Library */
luaL_register(mush_lua_env, "mush", mlua_lib);
+ /* Load Cobra SWIG Wrappers */
+ luaopen_cobra(mush_lua_env);
luaL_openlibs(mush_lua_env);
}
s = luaL_loadfile(mush_lua_env, "lua/test.lua");
- if(s==0) {
+ if(s==0)
s = lua_pcall(mush_lua_env, 0, LUA_MULTRET, 0);
- }
if(s != 0)
notify_format(enactor, "Lua Error: %s\n", lua_tostring(mush_lua_env, -1));
} else if(!lua_isnumber(L, 1)) {
lua_pushstring(L, "first argument must be an integer");
lua_error(L);
- } else {
-
- lua_concat(L, nargs-1);
- obj = lua_tonumber(L, 1);
-
- notify(obj, lua_tostring(L, -1) );
+ } else {
+ lua_concat(L, nargs-1);
+ obj = lua_tonumber(L, 1);
+ notify(obj, lua_tostring(L, -1) );
}
}
--- /dev/null
+%module cobra %{
+#include "conf.h"
+#include "externs.h"
+#include "dbdefs.h"
+
+extern struct db_stat_info current_state;
+%}
+void do_reboot(int player, int flag);
+%mutable;
+extern int shutdown_flag;
+extern struct db_stat_info current_state;
+