/* Execute byte code */
#define l_dobytecode(L, arr, len, name) \
(luaL_loadbuffer((L), (arr), (len), (name)) || lua_pcall((L), 0, LUA_MULTRET, 0))
-/** Load file in a sandbox environment. */
-#define l_dosandboxfile(L, filename) \
- (luaL_loadfile((L), (filename)) || engine_pcall((L), 0))
/*
* Global bindings.
int engine_load_sandbox(struct engine *engine)
{
/* Init environment */
- int ret = l_dosandboxfile(engine->L, LIBDIR "/sandbox.lua");
+ int ret = luaL_dofile(engine->L, LIBDIR "/sandbox.lua");
if (ret != 0) {
fprintf(stderr, "[system] error %s\n", lua_tostring(engine->L, -1));
lua_pop(engine->L, 1);
int engine_loadconf(struct engine *engine, const char *config_path)
{
assert(config_path != NULL);
- int ret = l_dosandboxfile(engine->L, config_path);
+ int ret = luaL_dofile(engine->L, config_path);
if (ret != 0) {
fprintf(stderr, "%s\n", lua_tostring(engine->L, -1));
lua_pop(engine->L, 1);
int engine_load_defaults(struct engine *engine)
{
/* Load defaults */
- int ret = l_dosandboxfile(engine->L, LIBDIR "/config.lua");
+ int ret = luaL_dofile(engine->L, LIBDIR "/config.lua");
if (ret != 0) {
fprintf(stderr, "%s\n", lua_tostring(engine->L, -1));
lua_pop(engine->L, 1);