mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-24 13:21:20 +00:00
Merge branch 'add-tofixed-lua' into 'next'
Add tofixed lua function See merge request STJr/SRB2!2430
This commit is contained in:
commit
432c0eaf2f
1 changed files with 13 additions and 0 deletions
|
@ -345,6 +345,18 @@ static int lib_reserveLuabanks(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_tofixed(lua_State *L)
|
||||
{
|
||||
const char *arg = luaL_checkstring(L, 1);
|
||||
char *end;
|
||||
float f = strtof(arg, &end);
|
||||
if (*end != '\0')
|
||||
lua_pushnil(L);
|
||||
else
|
||||
lua_pushnumber(L, FLOAT_TO_FIXED(f));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// M_MENU
|
||||
//////////////
|
||||
|
||||
|
@ -4333,6 +4345,7 @@ static luaL_Reg lib[] = {
|
|||
{"userdataMetatable", lib_userdataMetatable},
|
||||
{"IsPlayerAdmin", lib_isPlayerAdmin},
|
||||
{"reserveLuabanks", lib_reserveLuabanks},
|
||||
{"tofixed", lib_tofixed},
|
||||
|
||||
// m_menu
|
||||
{"M_MoveColorAfter",lib_pMoveColorAfter},
|
||||
|
|
Loading…
Reference in a new issue