forked from len0rd/rockbox
lua Fix a few potential bugs
Change-Id: I0293371c58f1ca2d148b3b1e1f780cf76f312ef9
This commit is contained in:
parent
aad15d5cd7
commit
8c36d8b131
3 changed files with 10 additions and 3 deletions
|
@ -96,7 +96,10 @@ static int math_floor (lua_State *L) {
|
|||
|
||||
static int math_fmod (lua_State *L) {
|
||||
/* Was: lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); */
|
||||
lua_pushnumber(L, luaL_checknumber(L, 1) % luaL_checknumber(L, 2));
|
||||
lua_Number n = luaL_checknumber(L, 1);
|
||||
lua_Number d = luaL_checknumber(L, 2);
|
||||
luaL_argcheck(L, d != 0, 2, "division by zero");
|
||||
lua_pushnumber(L, n % d);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue