Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bit32 is missing under Lua 5.3 #1338

Closed
Techokami opened this issue Jul 27, 2015 · 9 comments
Closed

bit32 is missing under Lua 5.3 #1338

Techokami opened this issue Jul 27, 2015 · 9 comments
Milestone

Comments

@Techokami
Copy link
Contributor

This breaks programs that use it, like wocchat. 😞

@magik6k
Copy link
Contributor

magik6k commented Jul 28, 2015

It's deprecated in Lua 5.3, Plan9k(MPT, not (yet) the floppy version) has compatibility code by default.

Workaround code:

--lua 5.3 <-> 5.2 compat
local bit32 = bit32 or load([[return {
    band = function(a, b) return a & b end,
    bor = function(a, b) return a | b end,
    bxor = function(a, b) return a ~ b end,
    bnot = function(a) return ~a end,
    rshift = function(a, n) return a >> n end,
    lshift = function(a, n) return a << n end,
}]])()

It's missing one or two functions IIRC, but it is enough for 99% of programs

@Vexatos
Copy link
Contributor

Vexatos commented Jul 28, 2015

"deprecated" meaning it's been completely removed from Lua 5.3. A workaround to re-add it would probably be good for compatibility, but I am not sure whether it should be done.

@Techokami
Copy link
Contributor Author

Good to see that Plan9k uses it, shame that a lot of programs are made for OpenOS and haven't been ported over (like the aformentioned wocchat).
I'll try adding the compat code as a lib for the time being.

@Techokami
Copy link
Contributor Author

Okay that code did not help:
screenshot 197

@dgelessus
Copy link
Contributor

If load returns false that means the code could not be compiled. What does print(load([[the code]])) show?

@fnuecke
Copy link
Member

fnuecke commented Jul 28, 2015

Eh, I suppose OpenOS could live with a compatibility lib in case it's 5.3, given how hot-swappable everything else is.

@fnuecke fnuecke added this to the v1.5.15 milestone Jul 28, 2015
@fnuecke
Copy link
Member

fnuecke commented Jul 28, 2015

In OpenOS as of f738684. Someone might want to test this, I only did very rudimentary checking...

@fnuecke fnuecke closed this as completed Jul 28, 2015
@Techokami
Copy link
Contributor Author

I'll give it a spin later on.

@Techokami
Copy link
Contributor Author

It seems to be working well! 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants