@@ -1116,7 +1116,12 @@ pub const Lua = struct {
1116
1116
c .luaL_checkany (lua .state , arg );
1117
1117
}
1118
1118
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
+
1120
1125
pub fn checkInteger (lua : * Lua , arg : i32 ) Integer {
1121
1126
return c .luaL_checkinteger (lua .state , arg );
1122
1127
}
@@ -1280,6 +1285,13 @@ pub const Lua = struct {
1280
1285
1281
1286
// luaL_opt (a macro) really isn't that useful, so not going to implement for now
1282
1287
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
+
1283
1295
/// If the function argument `arg` is an integer, returns the integer
1284
1296
/// If the argument is absent or nil returns `default`
1285
1297
pub fn optInteger (lua : * Lua , arg : i32 , default : Integer ) Integer {
0 commit comments