Skip to content
Snippets Groups Projects
Commit c208921c authored by Hanicef's avatar Hanicef
Browse files

Add tofixed lua function

parent b6544efc
No related branches found
No related tags found
1 merge request!2430Add tofixed lua function
...@@ -345,6 +345,18 @@ static int lib_reserveLuabanks(lua_State *L) ...@@ -345,6 +345,18 @@ static int lib_reserveLuabanks(lua_State *L)
return 1; 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 // M_MENU
////////////// //////////////
...@@ -4333,6 +4345,7 @@ static luaL_Reg lib[] = { ...@@ -4333,6 +4345,7 @@ static luaL_Reg lib[] = {
{"userdataMetatable", lib_userdataMetatable}, {"userdataMetatable", lib_userdataMetatable},
{"IsPlayerAdmin", lib_isPlayerAdmin}, {"IsPlayerAdmin", lib_isPlayerAdmin},
{"reserveLuabanks", lib_reserveLuabanks}, {"reserveLuabanks", lib_reserveLuabanks},
{"tofixed", lib_tofixed},
// m_menu // m_menu
{"M_MoveColorAfter",lib_pMoveColorAfter}, {"M_MoveColorAfter",lib_pMoveColorAfter},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment