[JW Lua] v0.67/Lua 5.4 report from Perfect Layout - incompatibillity with NaN
Jan Angermüller
jan at angermueller.com
Sun Mar 19 14:47:11 CET 2023
To have it all in one mail, here are more differences between 5.2/5.4
regarding infinity and not-a-number (NaN).
print(0/0, 1/0, math.huge, tostring(0/0), tostring(1/0) )
JW Lua 5.2 prints:
-1.#IND 1.#INF 1.#INF -1.#IND 1.#INF
RGP Lua 5.4/ZeroBrand Studio prints:
0/0 1/0 --[[math.huge]] 1/0 --[[math.huge]] "-nan(ind)" "inf"
The following code shows the difference:
local a=0/0
local b=0/0
local i
for i=a,b,1 do
print("In the Loop")
end
While in Lua 5.2 the loop is never entered, in Lua 5.4 it is entered
with i=0/0.
And if in the loop an array with index i is accessed, of course Lua 5.4
throws an error.
Ok, I must admit, I had not expected this scenario in my code because of
a phenomenon that I wasn't aware of:
print(math.pow(-27,1/3))
While this is obviously -3, Lua returns: -1.#IND = 0/0 = is not-a-number.
So I fixed that and it solved the problem.
(Interesting explanation:
https://stackoverflow.com/questions/14575697/math-pow-with-negative-numbers-and-non-integer-powers
)
So this may require extra exception handling - though it is probably a
very case.
It also occured only in one document of more than 100 test documents
with a special setup.
Robert, can this be solved with a compiler option?
But I have fixed in my code, so probably it will not be a problem anymore.
Jan
Am 18.03.2023 um 11:26 schrieb Jan Angermüller:
> Robert,
>
> I have just tested the Lua 5.4/0.67b version with Perfect Layout in
> Finale 27.3/*Windows* 10.
> BTW, since the last update v3.0127 Perfect Layout is also compatible
> with v0.66.
>
> Result: it works, except luaosutils.
>
> In detail:
> First I had to make *ZeroBrane studio* work as it seems to not support
> 5.4.x by default:
> -Download the Win64 lua5.4.*2* (!) binaries.*I haven't found binaries
> for 5.4.4.*
> The LuaBinaries project only goes up to 5.4.*2* (
> https://sourceforge.net/projects/luabinaries/files/ )
> Then:
> -Put lua54.dll/lua54.exe files into \ZeroBraneStudio\bin
> -Add clibs54 folder similar to clibs53 folder to
> \ZeroBraneStudio\bin (just copy&paste and then rename to 54)
> -Go to ZeroBraneStudio\interpreters and copy&paste luadeb53.lua and
> make it to luadeb54.lua.
> -Open luadeb54.lua and change 5.3 to 5.4
> -(Re-)Start ZeroBrane Studio and select Lua 5.4 in Project->Lua
> Interpreter.
>
> I had *five error messages* that didn't occcur in previous versions of
> RGP Lua/Lua 5.2 of which four could easily be fixed.
> 1.) there was a problem with a duplicate label name which Lua 5.2 has
> ignored (very weird)
> 2.) the "number of local variables exceeded" error occured (I wonder
> why it didn't occur in previous versions).
> 3.) tonumber(x,10) accepts both number OR string values for x in
> Lua5.2, in Lua5.4 only string values are accepted, otherwise error.
> 4.) the condition local x=0; local n=15; print((n % x)==0) printed
> "false" in Lua5.2, but gave an error in Lua 5.4 ("Error: attempt to
> perform n%0")
>
> These were all actually problems in Perfect Layout that Lua5.2 has
> ignored and which haven't lead to any problems yet.
> So I am glad I could improve my code here.
>
> However, I wasn't able to fix:
> *osutils=require("luaosutils") * --> this immediately lead to an
> error message although finaleplugin.LoadLuaOSUtils=true was in plugindef
> The result info box says: "Error:" No message.
> BTW, this pops up although it says
> finaleplugin.IgnoreReturnValue=true in the plugindef().
> And I called the uncompiled plug-in code directly - no extra require
> file was used as in the compiled version.
>
>
> So I removed that line completely and used the original JW Lua
> implementation without luaosutils and it, yay!, finally worked.
>
> Could it be that the Windows version of your embedded luaosutils has a
> problem? Haven't tested on macOS.
> Or do I need to change something in the setup?
>
> And finally:
> I have only tested my standard Perfect Layout demo score and another
> (simple) orchestra score.
> When the osutils issue is solved, I will run it in my standard tests
> where it automatically compares the output with v0.66.
> I haven't tested the 5.4 compiled version of Perfect Layout either.
>
> But so far, yes, it seems to work.
> Great job!
>
> Jan
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
--
Jan Angermüller
Orchideenstieg 13
22297 Hamburg
Tel. 040 - 28 94 84 82
Mobil 0173 - 99 33 904
www.elbsound.studio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20230319/4587c446/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gD9BTUGf70VvEVL6.png
Type: image/png
Size: 5152 bytes
Desc: not available
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20230319/4587c446/attachment.png>
More information about the JWLua
mailing list