@@ -1116,7 +1116,12 @@ pub const Lua = struct {
11161116 c .luaL_checkany (lua .state , arg );
11171117 }
11181118
1119- /// Checks whether the function argument `arg` is an integer (or can be converted to an integer) and returns the integer
1119+ /// Checks whether the function argument `arg` is a number and returns this number cast to an i32
1120+ /// See https://www.lua.org/manual/5.1/manual.html#luaL_checkint
1121+ pub fn checkInt (lua : * Lua , arg : i32 ) i32 {
1122+ return c .luaL_checkint (lua .state , arg );
1123+ }
1124+
11201125 pub fn checkInteger (lua : * Lua , arg : i32 ) Integer {
11211126 return c .luaL_checkinteger (lua .state , arg );
11221127 }
@@ -1280,6 +1285,13 @@ pub const Lua = struct {
12801285
12811286 // luaL_opt (a macro) really isn't that useful, so not going to implement for now
12821287
1288+ /// If the function argument `arg` is a number, returns this number cast to an i32.
1289+ /// If the argument is absent or nil returns `default`
1290+ /// /// See https://www.lua.org/manual/5.1/manual.html#luaL_optint
1291+ pub fn optInt (lua : * Lua , arg : i32 , default : i32 ) i32 {
1292+ return c .luaL_optint (lua .state , arg , default );
1293+ }
1294+
12831295 /// If the function argument `arg` is an integer, returns the integer
12841296 /// If the argument is absent or nil returns `default`
12851297 pub fn optInteger (lua : * Lua , arg : i32 , default : Integer ) Integer {
0 commit comments