[Suggestion] Lua 5.4, and...
That's it.
HILARIOUS aside, I'm suggesting it for the following reasons:
- New features that were added after 5.1 (of mixed usefulness), some of these being:
- 5.2: https://www.lua.org/manual/5.2/readme.html#changes
- goto statement (heavily restricted at that)
- break can appear in the middle of a block
- 5.3: https://www.lua.org/manual/5.3/readme.html#changes
- 64 bit integers
- native bitwise operators, including respective metamethods
- three new functions in the
string
library pertaining binary strings - new function in
table
library as well as table related functionality now respecting metamethods
- 5.4: https://www.lua.org/manual/5.4/readme.html#changes
- new mode for the garbage collector
- constant variables (awesome style), however the syntax is not pretty (
const var = 1
would be better) - to-be-closed variables - not particularly useful since it's for SRB2, and the only resources you'll probably open are files
- warning system (like
error
, but non-blocking)
- Several more changes I didn't consider to be major to write about them - Check the changelogs.
- 5.2: https://www.lua.org/manual/5.2/readme.html#changes
- The potential of keeping Lua updated with future Lua versions, in case something breaks.
- Comparatively faster than the current version of the interpreter (5.1)
- Other reasons that I may have forgotten or not taken into account, oops.
- LuaJIT might not be a good option at the moment: It's development (er, of stable releases) is very slow (if not at a standstill), and it doesn't have some of the features that future versions of Lua have introduced (some features were backported to 5.1 instead).
However it does have some cons versus LuaJIT, being
- It's comparatively slower
- Some of the additions may be considered bloat, and again, of varied usefulness
- ...I can't think of anything else at the moment
While at it, I would also want to suggest reverting some of the patches that were added:
- The optionality of
then
anddo
.- Making these optional doesn't particularly provide any benefit.
- It also makes snippets harder to read when new users are introduced to the language.
- The absolute excommunication of floating numbers.
- Floating numbers are very useful in calculations (i.e. trigonometry :smug:).
- It's hard and awkward to port some mathematical functionality to fixed point.
- About all devices out there support the same IEEE 754 floating point standard. Desynchronization due to this should be exceedingly rare.
- A warning/error could be implemented to notify/prevent the assignment of a floating number to any gameplay important userdata?
- The removal of the
math
library. (Only if floats are restored, otherwise they'd be rather useless)- Except for
math.random
andmath.randomseed
they might be useful for non-fixed point math. :)- Hm... maybe
random
could be useful. After all, if you were to set a seed before callingrandom
, the seed and subsequent results ofmath.random
calls should be the same across all clients.
- Hm... maybe
- Except for
Alternatively,
-
https://github.com/openresty/LuaJIT2/
- I haven't read about this one much.
-
https://luau-lang.org
- This one comes from Roblox. It has a plethora of features - A bit overwhelming, but interesting.
- It's backwards compatible with 5.1 (interpreter infers typing).
- One of its main goals is performance.
- Site has a bunch of pages. It's a good read, might give ideas if anything.
Mainly wanted to write this here so it's available somewhere, and to compile any comments, problems and solutions that may arise in one place.