Open totalgee opened 2 years ago
If Luau has a C API, sure.
If it doesn't have a C API, then probably not!
Thanks. It does seem to have a C API that is allegedly compatible with Lua 5.1...according to the README:
The runtime mostly preserves Lua 5.1 API, so existing bindings should be more or less compatible with a few caveats.
So what are those caveats? It seems to be:
Luau closely tracks that API but has a few deviations, such as the need to compile source separately (which is important to be able to deploy VM without a compiler), or lack of
__gc
support (uselua_newuserdatadtor
instead).
I've not had a chance to try it with Sol yet, but hopefully I will in the coming weeks.
Doesn't appear to work so easily. I just tried to quickly compile them and got this error:
sol2\include\sol/compatibility/lua_version.hpp(40): fatal error C1083: Cannot open include file: 'lauxlib.h': No such file or directory
It appears that Luau has changed some of the API of Lua as well. I attempted to readd the lauxlib.h to Luau just to get it to compile but a ton of errors start popping up from Sol's compatibility layer.
Luau does not define any LUA_VERSION_NUM
, and setting it to 5.1 causes a ton of issues still.
There's actually a whole list of changes in the Luau repo here: https://github.com/Roblox/luau/issues/251
Does look like someone has managed to replace their Lua 5.1/Luajit version with Luau:
https://github.com/Roblox/luau/discussions/240
From what I can tell, I'm not sure if it's viable unless someone wants to put in a ton of work. The person who got it worked stated they even had to make some changes to Luau's source afaik.
Ah, cool, thanks for the link @dhkatz ! It does indeed look non-trivial, though...
https://github.com/kunitoki/LuaBridge3 is the only binder supporting lua, luajit and luau
Looks nice! I'll have to focus on Luau support first-thing, then. I was hoping Luau would just..... build, out of the box.
Time to fix that!
should be pretty easy, the only tricky thing is getting all internal and user registrations to cleanup correctly without having __gc support in metatables... quite weird they don't want to support it, but 🤷🏻♂️
....
Wait they don't provide WHAT--
They have a construct similar to a new taking a callable destructor, they name it lua_newuserdatadtor where you can delete the objects, but any metatable __gc will be ignored.
I have some wrapping i use in luabridge3, but in general it's quite a behaviour switch and needs some tinkering to make it work with tables https://github.com/Roblox/luau/issues/256
Any updates on this :o?
....
Wait they don't provide WHAT--
Given this, are we to presume this isn't going to happen? :sweat_smile:
Like the other 100+ issues on this repo, I actually do plan to get to work on this. This year was supposed to be my "off" year, but I instead have to fight with a second Committee-Draft ballot for C23 (which is now looking like C24 since it will take so long) and like 30 other things. I'm hoping that before December I can finally start knocking tons of stuff out, but I have not been having luck focusing on my precious sol2 baby lately... 🥲
Would love to hear any updates on this so far @ThePhD ?
Following up again on this?
me too
And another request for update :) Luau is slowly taking over the Lua world, so getting support for it would be amazing!
I was wondering if Sol would be expected to work with Luau as well as it does with "pure" Lua. I expect to try it out in a test application at some point (and can report back here), but am wondering if anyone else has already had experience trying it?
Luau is apparently "syntactically backwards-compatible with Lua 5.1," but has some extensions with new syntax and nice things like type annotations and checking, compound assignments and more literals. It is an open-source project developed by the folks at Roblox.