Fix test-instruction with non-booleans

This commit is contained in:
Sofia 2026-03-22 00:23:31 +02:00
parent cc943915b2
commit 67560795a1
2 changed files with 5 additions and 111 deletions

View File

@ -1,112 +1,6 @@
global b = 5
function add(x)
return function (y)
x = x + 1
b = b + 1
return x + y, 1, 2, b
end
function _update()
end
function min(x, y)
local m = x
if y < x then
m = y
end
return m
if _update60 then
_update = _update60
end
function f(x, ...)
local b = {10, ..., add(10)(15)}
return x + 5, b
end
global sometable = {}
sometable["hello"] = { 100, 150, add(10)(15) }
print(#sometable["hello"])
sometable["hello"].there = "my dude"
print(sometable.hello.there)
print(max(11.12345, 9))
print(add(10)(15))
print(add(10)(15))
print(b)
print(min(11, 9))
print(10 - 15)
print("hello there!")
print(true or 0)
global value, table = f(10, 11, 12)
print("hello")
for i=1,#table do
print(table[i])
if i > 2 then
goto test
end
end
::test::
local test = table[1]
if test == 10 then
print("first")
elseif test == 11 then
print("second")
else
print("third")
end
print("after if/elseif/else")
local i = 0
print("before")
while i < 10 do
i = i + 1
print(i)
end
print("after while")
local i = 0
print("before")
repeat
i = i + 1
print(i)
until i >= 10
print("after repeat")
function ipairs(t)
print("inside!")
local i = 0
return function (state, control)
print(state, control)
i = i + 1
if i > #table then
return nil, nil
end
return i, t[i]
end, "otus", "potus"
end
for k, v in (ipairs(table)) do
print(k, v)
end
print("hello " .. "there")
SETMETATABLE(table, {
__add = function ()
return 1
end,
__call = function (table, ...)
print(...)
return 1, 2, 3
end
})
print(table + 5)
print(table("hello", "there"))
print("hello ", table)
_update()

View File

@ -730,7 +730,7 @@ impl<UserData: Clone> ClosureRunner<UserData> {
.unwrap_or(Value::Nil)
{
Value::Boolean(val) => (val.0 as u16) == *c,
_ => false,
_ => (false as u16) == *c,
};
if is_true {
let b = self.get_stack(*b);