Simplify hook code
This commit is contained in:
parent
92016a742b
commit
58c42eec29
|
@ -155,25 +155,13 @@ static int lib_addHook(lua_State *L)
|
||||||
hook.s.skinname = NULL;
|
hook.s.skinname = NULL;
|
||||||
if (lua_isstring(L, 2))
|
if (lua_isstring(L, 2))
|
||||||
{ // lowercase copy
|
{ // lowercase copy
|
||||||
const char *s = lua_tostring(L, 2);
|
hook.s.skinname = Z_StrDup(lua_tostring(L, 2));
|
||||||
char *p = hook.s.skinname = ZZ_Alloc(strlen(s)+1);
|
strlwr(hook.s.skinname);
|
||||||
do {
|
|
||||||
*p = tolower(*s);
|
|
||||||
++p;
|
|
||||||
} while(*(++s));
|
|
||||||
*p = 0;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case hook_LinedefExecute: // Linedef executor functions
|
case hook_LinedefExecute: // Linedef executor functions
|
||||||
{ // uppercase copy
|
hook.s.skinname = Z_StrDup(luaL_checkstring(L, 2));
|
||||||
const char *s = luaL_checkstring(L, 2);
|
strupr(hook.s.skinname);
|
||||||
char *p = hook.s.funcname = ZZ_Alloc(strlen(s)+1);
|
|
||||||
do {
|
|
||||||
*p = toupper(*s);
|
|
||||||
++p;
|
|
||||||
} while(*(++s));
|
|
||||||
*p = 0;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue