src/spbot/lua_config.c
branchnew-lib-errors
changeset 218 5229a5d098b2
parent 217 7728d6ec3abf
equal deleted inserted replaced
217:7728d6ec3abf 218:5229a5d098b2
       
     1 #include "lua_config.h"
       
     2 
       
     3 #include <lua5.1/lauxlib.h>
       
     4 
       
     5 err_t lua_config_load (struct nexus_lua *lua, const char *path, error_t *err)
       
     6 {
       
     7     // just use luaL_loadfile and translate the error code
       
     8     if (nexus_lua_error(lua->st, luaL_loadfile(lua->st, path), err))
       
     9         // XXX: pollute the stack
       
    10         return ERROR_CODE(err);
       
    11     
       
    12     // execute it
       
    13     // XXX; error handler with debug info
       
    14     return nexus_lua_error(lua->st, lua_pcall(lua->st, 0, 0, 0), err);
       
    15 }
       
    16