Jump to content




is ComputerCraft ever going to update to Lua 5.2?


  • This topic is locked This topic is locked
9 replies to this topic

#1 tesla1889

  • Members
  • 351 posts
  • LocationSt. Petersburg

Posted 08 February 2013 - 06:42 PM

title asks it all

EDIT: i only ask to know if i should plan for compatibility

#2 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 09 February 2013 - 01:33 AM

Doubt it. Would break a lot of programs.

#3 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 09 February 2013 - 07:05 AM

getfenv() and setfenv() were both removed in 5.2. For good reason, I hope.

#4 tesla1889

  • Members
  • 351 posts
  • LocationSt. Petersburg

Posted 09 February 2013 - 12:40 PM

View PostKingdaro, on 09 February 2013 - 07:05 AM, said:

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

#5 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 09 February 2013 - 12:42 PM

ipairs was also removed in 5.2, Though there are alternatives. This would break many programs also.

#6 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 09 February 2013 - 12:50 PM

ipairs isn't removed, it's only deprecated.

View Posttesla1889, on 09 February 2013 - 12:40 PM, said:

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
I tried screwing around with _ENV, but could never fully figure it out. I'll look up a tutorial or something later on.

#7 tesla1889

  • Members
  • 351 posts
  • LocationSt. Petersburg

Posted 09 February 2013 - 12:55 PM

_ENV is the environment table

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


#8 hvenev

  • Members
  • 6 posts

Posted 20 September 2013 - 03: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/d.../lua-compat-env

#9 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 20 September 2013 - 08:32 AM

It's not happening. Stop bringing it up.

#10 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 20 September 2013 - 12:10 PM

Also, I have no idea where the ipairs being removed/deprecated nonsense came from, since Lua 5.2 adds an __ipairs metamethod.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users