add quick error messages to make toaster happy

This commit is contained in:
Monster Iestyn 2017-11-01 17:11:10 +00:00
parent a244948f21
commit fbe5654477
2 changed files with 4 additions and 4 deletions

View file

@ -8336,10 +8336,10 @@ static int lib_getActionName(lua_State *L)
actionf_t *action = *((actionf_t **)luaL_checkudata(L, 1, META_ACTION));
const char *name = NULL;
if (!action)
return 0; // insert error here (or not?)
return luaL_error(L, "not a valid action?");
name = LUA_GetActionName(action);
if (!name) // that can't be right?
return 0;
return luaL_error(L, "no name string could be found for this action");
lua_pushstring(L, name);
return 1;
}

View file

@ -321,7 +321,7 @@ static int lib_setState(lua_State *L)
actionf_t *action = *((actionf_t **)luaL_checkudata(L, 3, META_ACTION));
if (!action)
return 0; //insert error here
return luaL_error(L, "not a valid action?");
state->action = *action;
state->action.acv = action->acv;
@ -527,7 +527,7 @@ static int state_set(lua_State *L)
actionf_t *action = *((actionf_t **)luaL_checkudata(L, 3, META_ACTION));
if (!action)
return 0; //insert error here
return luaL_error(L, "not a valid action?");
st->action = *action;
st->action.acv = action->acv;