Comments (11)
Lua 5.3 without compatibility does provide a builtin bit32 module -- it just throws an error when loaded. Even if LuaRocks installed the rock, Lua 5.3 would still use the builtin, error-throwing one. Also, bit32 is a compatibility library, so it makes sense to assume that you either built with compatibility (which is the default) and you already have it, or you explicitly disabled compatibility and thus you don't want the non-error-throwing one.
from lua-compat-5.3.
I haven't had a closer look at the API changes, yet, but my first impression is that we can't do much about 5.4. I've seen:
lua_version
has changedlua_resume
has an extra parameter- we could try to emulate multiple uservalues (at some performance cost)
lua_pushfail
is trivial- maybe something about the new warning system
luaL_addgsub
luaL_argexpected
luaL_buffaddr
luaL_buflen
luaL_bufsub
luaL_tolstring
is slightly stricterluaL_typeerror
For now, the newly released version should work for Lua 5.4.
from lua-compat-5.3.
Thanks for allowing this to run on Lua 5.4 systems. Can we get release on Luarocks too? Pretty please with a cherry?
from lua-compat-5.3.
Aaha I see you did a Luarocks release for compat53, but can we get a matching one for bit32?
from lua-compat-5.3.
I've added the bit32 library to this repository. I hope it works as intended ...
from lua-compat-5.3.
Not really, but it's complicated to test because of this luarocks issue.
Even when that is sorted out though I think there is going to be a problem with the bit32 module itself. Lua 5.3 by default included this this, so the bit32 load being a noop
was sort of correct. But it didn't include it if you disabled the Lua 5.2 compatibility flag. Lua 5.4 doesn't include it at all.
In other words for code to be compatible with Lua 5.2, the bit32 module needs to stop being a noop
and start actually providing something for 5.1 and 5.4, plus check 5.3 for whether the module exists already.
from lua-compat-5.3.
from lua-compat-5.3.
use this: luaposix/luaposix@5d5e06e
Be very careful with such code; different bit libraries (and the operators) all behave differently in regards to signedness, overflow and other properties. See https://github.com/daurnimator/lua-http/blob/47225d081318e65d5d832e2dd99ff0880d56b5c6/http/bit.lua#L3-L7
from lua-compat-5.3.
@alerque I'm not sure I can follow. The bit32 backport in this repo compiles and works (according to my very primitive tests) for Lua 5.1 and Lua 5.4. The module should be unnecessary for Lua 5.2 and Lua 5.3 because those versions contain a native version of bit32, and LuaRocks will favor this native version automatically.
from lua-compat-5.3.
and LuaRocks will favor this native version automatically.
That's what should happen, but it isn't what Luarocks 3.3.1 actually does. Even when Lua 5.3 is compiled without 5.2 compatibly flags it assumes that it has a bit32
module internally and refuses to install the rock on the grounds that it's provided by the VM ... even though it hasn't actually checked that is the case.
from lua-compat-5.3.
However, maybe we should be deprecating the compat-5.3 project and creating a compat-5.4?
Makes sense to me!
I haven't had a closer look at the API changes, yet, but my first impression is that we can't do much about 5.4.
Hopefully the changes are not too drastic, then?
we could try to emulate multiple uservalues (at some performance cost)
What do you have in mind? I guess a weak-keys table in the registry mapping userdata to arrays would do the trick?
maybe something about the new warning system
Even something super basic like this would be nice as a start:
do
local warnings_on = false
function warn(msg, ...)
if msg == "@on" and select("#", ...) == 0 then
warnings_on = true
elseif msg == "@off" and select("#", ...) == 0 then
warnings_on = false
elseif warnings_on then
io.stderr:write("Lua warning: ", msg, ...)
io.stderr:write("\n")
end
end
end
...though of course it could get fancier if it was to support the C API side of it as well. For user-produced warnings looks that would be doable. I don't think a library author cares about the Lua-generated warnings added in 5.4; those are the concern of whoever is embedding Lua, and if they care about warnings for these failure conditions they'll be probably embedding 5.4 anyway.
For now, the newly released version should work for Lua 5.4.
This is great, thank you! :)
Looking at the library incompatibilities list for the Lua standard library side of things, I think one possible change in compat-5.4 would be to pick the new lutf8lib.c which adds the lax
argument.
from lua-compat-5.3.
Related Issues (20)
- luaL_Stream
- LUAERRGCM missing HOT 1
- luaL_loadbufferx HOT 1
- Problems with detection of strerror_r HOT 3
- lua_getuservalue should return type HOT 2
- lua_tointegerx accepts non-integers HOT 5
- Build fail with x86_64-w64-mingw32-gcc on MacOS HOT 1
- luaossl installation fails on alpine docker image HOT 8
- src/compat-5.3.c:59:9: error: implicit declaration of function 'strerror_r' [-Werror=implicit-function-declaration]
- src/compat-5.3.c:451:42: error: initializer element is not computable at load time [-Werror=pedantic] HOT 2
- luaL_typeerror HOT 4
- How to compile on windows HOT 4
- Tests fail on 32bit systems HOT 18
- table.maxn HOT 2
- lprefix.h fails with compilation error HOT 1
- release automation HOT 3
- installing compat-5.3.h by luarocks HOT 1
- Compiling on windows (through luarocks) fails, it thinks my system is POSIX HOT 10
- Unable to install from luarocks on Windows: C4047 issue on liolib.c HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-compat-5.3.