You want `lua_tonumber` when getting the parameter values, not `lua_tointeger`. But actually, I think you can remove these if statements completely and use the [`luaL_optnumber`](http://www.lua.org/manual/5.2/manual.html#luaL_optnumber) function to get the parameters.