aboutsummaryrefslogtreecommitdiff
path: root/src/math.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/math.c')
-rw-r--r--src/math.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/math.c b/src/math.c
index e7cd1bb..47e8391 100644
--- a/src/math.c
+++ b/src/math.c
@@ -65,10 +65,10 @@ int l_random(lua_State* L){
size_t min = 1;
switch(lua_gettop(L)){
case 2:
- min = lua_tointeger(L, 1);
+ min = luaL_checkinteger(L, 1);
lua_remove(L, 1);
case 1:
- lua_pushinteger(L, (erand48(seedv) * (lua_tointeger(L, 1) - min + 1)) + min);
+ lua_pushinteger(L, (erand48(seedv) * (luaL_checkinteger(L, 1) - min + 1)) + min);
break;
case 0:
default: