Skip to content

Commit 89826d2

Browse files
authored
Fix panic when Lua integer is out of range of destination type (#224)
1 parent d2cb619 commit 89826d2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/lib.zig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4887,7 +4887,7 @@ pub const Lua = opaque {
48874887
switch (type_info) {
48884888
.int => {
48894889
const result = try lua.toInteger(index);
4890-
return @as(T, @intCast(result));
4890+
return std.math.cast(T, result) orelse error.LuaIntegerOutOfRange;
48914891
},
48924892
.float => {
48934893
const result = try lua.toNumber(index);

0 commit comments

Comments
 (0)