mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Simplify hook code
This commit is contained in:
parent
d11479b493
commit
85d0a92eb4
1 changed files with 4 additions and 16 deletions
|
|
@ -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…
Add table
Reference in a new issue