File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -2596,14 +2596,12 @@ pub const Lua = opaque {
25962596
25972597 /// Converts the Lua value at the given `index` to a numeric type;
25982598 /// if T is an integer type, the Lua value is converted to an integer.
2599- /// The conversion from `Integer` or `Number` to T is performed with `@_Cast`,
2600- /// which will assert in builds with runtime safety enabled
26012599 ///
26022600 /// * Pops: `0`
26032601 /// * Pushes: `0`
2604- /// * Errors: `never`
2602+ /// * Errors: `error.IntegerCastFailed` if `T` is an integer type and the value at index doesn't fit
26052603 pub fn toNumeric (lua : * Lua , comptime T : type , index : i32 ) ! T {
2606- if (@typeInfo (T ) == .int ) return @intCast (try lua .toInteger (index ));
2604+ if (@typeInfo (T ) == .int ) return std . math . cast (try lua .toInteger (index )) orelse error . IntegerCastFailed ;
26072605 return @floatCast (try lua .toNumber (index ));
26082606 }
26092607
You can’t perform that action at this time.
0 commit comments