EDIT: i only ask to know if i should plan for compatibility
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
is ComputerCraft ever going to update to Lua 5.2?
Started by tesla1889, 08 February 2013 - 05:42 PMPosted 08 February 2013 - 06:42 PM
title asks it all
EDIT: i only ask to know if i should plan for compatibility
EDIT: i only ask to know if i should plan for compatibility
Posted 09 February 2013 - 01:33 AM
Doubt it. Would break a lot of programs.
Posted 09 February 2013 - 07:05 AM
getfenv() and setfenv() were both removed in 5.2. For good reason, I hope.
Posted 09 February 2013 - 12:40 PM
getfenv() and setfenv() were both removed in 5.2. For good reason, I hope.
there are work arounds for both of those involving the added _ENV table. i ask because i often find myself using those and i want compatibility
Posted 09 February 2013 - 12:42 PM
ipairs was also removed in 5.2, Though there are alternatives. This would break many programs also.
Posted 09 February 2013 - 12:50 PM
ipairs isn't removed, it's only deprecated.
I tried screwing around with _ENV, but could never fully figure it out. I'll look up a tutorial or something later on.there are work arounds for both of those involving the added _ENV table. i ask because i often find myself using those and i want compatibility
Posted 09 February 2013 - 12:55 PM
_ENV is the environment table
a workaround for setfenv would be
a workaround for setfenv would be
setfenv = function(fn,env)
if (type(fn) ~= "function") or (type(env) ~= "table") then
error("invalid args")
end
env.main = fn
env.oldenv = _ENV
return function(...)
_ENV = env
local t = {main(...)}
_ENV = oldenv
return unpack(env.t)
end
end
Posted 20 September 2013 - 04:42 AM
I need lua 5.2 for my scripts.
There is an implementation of {get,set}fenv for lua 5.2. https://github.com/davidm/lua-compat-env
There is an implementation of {get,set}fenv for lua 5.2. https://github.com/davidm/lua-compat-env
Posted 20 September 2013 - 09:32 AM
It's not happening. Stop bringing it up.
Posted 20 September 2013 - 01:10 PM
Also, I have no idea where the ipairs being removed/deprecated nonsense came from, since Lua 5.2 adds an __ipairs metamethod.