src/lua_config.c
author Tero Marttila <terom@fixme.fi>
Sat, 23 May 2009 00:33:23 +0300
changeset 215 85863b89e38b
parent 106 f00661136ac2
child 217 7728d6ec3abf
permissions -rw-r--r--
fix lua_thread_resume_state to not call lua_resume from a CFunction executing in the same state; lua_thread_done is now unprotected...
#include "lua_config.h"

#include <lua5.1/lauxlib.h>

err_t lua_config_load (struct nexus_lua *lua, const char *path, struct error_info *err)
{
    // just use luaL_loadfile and translate the error code
    if (nexus_lua_error(lua->st, luaL_loadfile(lua->st, path), err))
        // XXX: pollute the stack
        return ERROR_CODE(err);
    
    // execute it
    // XXX; error handler with debug info
    return nexus_lua_error(lua->st, lua_pcall(lua->st, 0, 0, 0), err);
}