Replies: 3 comments 6 replies
-
Question is, how would this impact compatibility with existing CC software? There's a lot of older stuff that would be a shame to lose, but the original devs are no longer active. |
Beta Was this translation helpful? Give feedback.
-
I'm not looking forward to there being a bunch of poorly written (yet somehow popular) programs out there using |
Beta Was this translation helpful? Give feedback.
-
Thanks for looking into this! I know how horrific a) the Lua 5.1 -> 5.2 changes re and b) Cobalt's code base is. This is one of those fun issues where I want to do it, but absolutely petrified of how much it's going to break. I guess we'll need a lot of compatibility tests.
I've been very obsessive about backwards compatibility (or not), and I don't think that will change here. I think it's unavoidable that CC will live in a weird hybrid land of 5.1-5.2 (or more in the future). That said, things are going to break. It's always going to be possible to write a program which behaves differently before/after 5.2, the hard thing will just be minimising the damage in such a way it doesn't affect any reasonable user program. Anyway, haven't really got anything concrete to say, just going to go on one of my regularly scheduled rambles...
Environments are going to be impossible to handle correctly, I think we just need to find a scheme which minimises breakage. Running 5.1 bytecode is probably an edge case (does anything but JVML-JIT use it?), so I don't want to get too bogged down (though it still would be good to support it). Instead of inserting upvalues for these bytecode functions, I wonder if we can have two versions of Then
Not sure whether we want to fail hard in some of those cases instead of returning dummy values/doing nothing. Don't know, haven't put too much thought into it. May just be bikeshedding. |
Beta Was this translation helpful? Give feedback.
-
I've been taking a look at upgrading Cobalt for Lua 5.2. As it stands now, there aren't many things that Cobalt is missing to be able to support 5.2. The main things I can think of are
_ENV
environments, labels andgoto
, and Lua 5.2 bytecode support (and uservalues, but I'm not sure how that applies to Cobalt yet). So far, I have made a fork of Cobalt that adjusts the VM to use 5.1 and 5.2 instructions, allowing both 5.1 and 5.2 bytecode to be loaded; as well as adding rudimentary_ENV
support. However, it's currently missing 5.2 bytecode generation (it still outputs for 5.1), as well as labels &goto
; and it's very broken and needs much more work to be functional.I'm thinking that for Minecraft 1.17, CC: Tweaked could be updated with this new Cobalt version (once complete) to officially support Lua 5.2. (This could be associated with a bump to 2.0.0?) To accommodate transition and try to keep compatibility:
getfenv
/setfenv
, using alternatives in Lua or Java that set the_ENV
upvaluedisable_lua51_features
is false (implementing in Lua if necessary)_ENV
upvalues for each functionI'd be willing to put some time into this project to get it working fully. However, it's going to take a lot of work, and I'd like to see what people think about it before I fully commit. I'm probably also going to need some help with getting things fully integrated/cleaned up, as well as beta tests with the new Cobalt to make sure everything works properly. I'm not very acquainted with Lua 5.2 itself, too, so getting some advice on its differences from 5.1 would be helpful.
Thoughts on Lua 5.2 support in CC:T?
Beta Was this translation helpful? Give feedback.
All reactions