-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
-- TEP version 0.085.-1 beta
Trigger {
players = {P1},
conditions = {
Always();
},
actions = {
Wait(2^31);
}
}
--[[
Compile failed because of the following reason:
Error while running trigger script
stack traceback:
[C]: in global '__internal__AddTrigger'
[string "basescript"]:117: in global 'Trigger'
[string "main"]:3: in main chunk
[string "basescript"]:117: bad argument #-7 to '__internal__AddTrigger'
(number has no integer representation)
Compile failed.
]]Using 2,147,483,648 won't cause this error.
Lua upgrading to 5.3.2 in TEP 0.085.-1 beta might cause this problem?
A workaround
-- workaround 1
function lshift (a, b) -- lua 5.2 bit32.lshift
return ((a & 0xFFFFFFFF) << b) & 0xFFFFFFFF
end
for i = 31, 0, -1 do
x = lshift(1, i)
Trigger {
players = {P1},
conditions = {
Never();
},
actions = {
Wait(x);
}
}
end
--[[
outcomes:
-2147483648, 1073741824, 536870912, 268435456,
134217728, 67108864, 33554432, 16777216
8388608, 4194304, 2097152, 1048576, 524288, 262144, 131072, 65536
32768, 16384, 8192, 4096, 2048, 1024, 512, 256
128, 64, 32, 16, 8, 4, 2, 1
]]-- workaround 2
x = 2147483648
for i = 31, 0, -1 do
Trigger {
players = {P1},
conditions = {
Never();
},
actions = {
Wait(x);
}
}
x = x / 2 if x < 0 then x = -x end
endReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels