equal
deleted
inserted
replaced
25 // XXX: we don't need all of these |
25 // XXX: we don't need all of these |
26 // XXX: errors? |
26 // XXX: errors? |
27 luaL_openlibs(lua->st); |
27 luaL_openlibs(lua->st); |
28 |
28 |
29 // then our own things |
29 // then our own things |
30 if ((ERROR_CODE(err) = lua_objs_init(lua))) |
30 if (lua_objs_init(lua, err)) |
31 goto error; |
31 goto error; |
32 |
32 |
33 // ok |
33 // ok |
34 *lua_ptr = lua; |
34 *lua_ptr = lua; |
35 |
35 |
46 // close the lua stuff |
46 // close the lua stuff |
47 lua_close(lua->st); |
47 lua_close(lua->st); |
48 |
48 |
49 free(lua); |
49 free(lua); |
50 } |
50 } |
|
51 |
|
52 err_t nexus_lua_error (lua_State *L, int ret, struct error_info *err) |
|
53 { |
|
54 const char *error = lua_tostring(L, -1); |
|
55 |
|
56 switch (ret) { |
|
57 case 0: RETURN_SET_ERROR(err, SUCCESS); |
|
58 case LUA_ERRSYNTAX: RETURN_SET_ERROR_STR(err, ERR_LUA_SYNTAX, error); |
|
59 case LUA_ERRRUN: RETURN_SET_ERROR_STR(err, ERR_LUA_RUN, error); |
|
60 case LUA_ERRMEM: RETURN_SET_ERROR_STR(err, ERR_LUA_MEM, error); |
|
61 case LUA_ERRERR: RETURN_SET_ERROR_STR(err, ERR_LUA_ERR, error); |
|
62 case LUA_ERRFILE: RETURN_SET_ERROR_STR(err, ERR_LUA_FILE, error); |
|
63 default: RETURN_SET_ERROR_EXTRA(err, ERR_UNKNOWN, ret); |
|
64 }; |
|
65 } |