src/nexus_lua.c
branchnew-lib-errors
changeset 217 7728d6ec3abf
parent 207 3fa22abb5421
equal deleted inserted replaced
216:a10ba529ae39 217:7728d6ec3abf
    29 
    29 
    30     // ok
    30     // ok
    31     return 0;
    31     return 0;
    32 }
    32 }
    33 
    33 
    34 err_t nexus_lua_create (struct nexus_lua **lua_ptr, struct nexus *nexus, struct error_info *err)
    34 err_t nexus_lua_create (struct nexus_lua **lua_ptr, struct nexus *nexus, error_t *err)
    35 {
    35 {
    36     struct nexus_lua *lua;
    36     struct nexus_lua *lua;
    37 
    37 
    38     // alloc
    38     // alloc
    39     if ((lua = calloc(1, sizeof(*lua))) == NULL)
    39     if ((lua = calloc(1, sizeof(*lua))) == NULL)
    67     lua_close(lua->st);
    67     lua_close(lua->st);
    68 
    68 
    69     free(lua);
    69     free(lua);
    70 }
    70 }
    71 
    71 
    72 err_t nexus_lua_eval (struct nexus_lua *lua, const char *chunk, struct error_info *err)
    72 err_t nexus_lua_eval (struct nexus_lua *lua, const char *chunk, error_t *err)
    73 {
    73 {
    74     int ret;
    74     int ret;
    75     bool loaded = false;
    75     bool loaded = false;
    76 
    76 
    77     RESET_ERROR(err);
    77     RESET_ERROR(err);
    97     }
    97     }
    98 
    98 
    99     return ERROR_CODE(err);
    99     return ERROR_CODE(err);
   100 }
   100 }
   101 
   101 
   102 err_t nexus_lua_error (lua_State *L, int ret, struct error_info *err)
   102 err_t nexus_lua_error (lua_State *L, int ret, error_t *err)
   103 {
   103 {
   104     // XXX: this can raise an erorr itself
   104     // XXX: this can raise an erorr itself
   105     const char *error = lua_tostring(L, -1);
   105     const char *error = lua_tostring(L, -1);
   106 
   106 
   107     switch (ret) {
   107     switch (ret) {