Lua 5.3+ fixes

This commit is contained in:
Adrian Siekierka 2023-05-30 21:12:53 +02:00
parent 1c163dd701
commit c71c1479dd
3 changed files with 16 additions and 9 deletions

View File

@ -162,7 +162,7 @@ dependencies {
compile 'com.google.code.findbugs:jsr305:1.3.9' // Annotations used by google libs.
embedded name: 'OC-LuaJ', version: '20220907.1', ext: 'jar'
embedded name: 'OC-JNLua', version: '20220928.1', ext: 'jar'
embedded name: 'OC-JNLua', version: '20230530.0', ext: 'jar'
embedded name: 'OC-JNLua-Natives', version: '20220928.1', ext: 'jar'
testCompile "org.mockito:mockito-all:1.10.19"

View File

@ -1,4 +1,8 @@
## New Features/Support
## Fixes/improvements
* Reverted Internet Card code to OC 1.7.7, fixing the many related regressions.
* Fixed "number expected, got number" being displayed instead of "number has no integer representation" on Lua 5.3+.
* Fixed math.randomseed() not working with non-integer values.
## OpenOS fixes/improvements

View File

@ -893,17 +893,19 @@ sandbox = {
acos = math.acos,
asin = math.asin,
atan = math.atan,
atan2 = math.atan2,
atan2 = math.atan2 or math.atan, -- Deprecated in Lua 5.3
ceil = math.ceil,
cos = math.cos,
cosh = math.cosh,
cosh = math.cosh, -- Deprecated in Lua 5.3
deg = math.deg,
exp = math.exp,
floor = math.floor,
fmod = math.fmod,
frexp = math.frexp,
frexp = math.frexp, -- Deprecated in Lua 5.3
huge = math.huge,
ldexp = math.ldexp,
ldexp = math.ldexp or function(a, e) -- Deprecated in Lua 5.3
return a*(2.0^e)
end,
log = math.log,
max = math.max,
min = math.min,
@ -917,13 +919,14 @@ sandbox = {
return spcall(math.random, ...)
end,
randomseed = function(seed)
spcall(math.randomseed, seed)
-- math.floor(seed) emulates pre-OC 1.8.0 behaviour
spcall(math.randomseed, math.floor(seed))
end,
sin = math.sin,
sinh = math.sinh,
sinh = math.sinh, -- Deprecated in Lua 5.3
sqrt = math.sqrt,
tan = math.tan,
tanh = math.tanh,
tanh = math.tanh, -- Deprecated in Lua 5.3
-- Lua 5.3.
maxinteger = math.maxinteger,
mininteger = math.mininteger,