LuPPC/src/c/run.c

25 lines
455 B
C
Raw Normal View History

2016-01-04 04:08:43 +11:00
#include "luares.h"
#include "lupi.h"
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
2016-01-05 04:20:40 +11:00
#include <stdlib.h>
2016-01-04 04:08:43 +11:00
void run_init() {
lua_State *L;
L = luaL_newstate();
2016-01-07 03:16:09 +11:00
2016-01-07 02:58:05 +11:00
luaL_openlibs (L);
setup_modules (L);
2016-01-07 03:16:09 +11:00
luanative_start (L);
2016-01-07 02:58:05 +11:00
termutils_start (L);
2016-01-04 04:08:43 +11:00
int status = luaL_loadstring(L, lua_init);
if (status) {
fprintf(stderr, "Couldn't load init: %s\n", lua_tostring(L, -1));
exit(1);
}
lua_call(L, 0, 0);
lua_close(L);
}