generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: if only we had lua 5.2

Previous Thread :: Next Thread 
SethDusek5 is not online. SethDusek5
Joined: 26 Mar 2011
Total Posts: 2580
30 Oct 2014 08:18 AM
so probably the reason why we dont have lua 5.2 is because there is no setfenv/getfenv.
But imagine this:
You have a table something like this
local info = {name = "john",age=50}

now if you did
print(#info)
It'd print 0. But if you had lua 5.2 you could do this

local info = {name = "john",age=50}
setmetatable(info,{__len = function(t) local num = 0 for i,v in next,t do num = num+1 end return num end})

print(#info) --2
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
30 Oct 2014 10:54 AM
Clearly I am misunderstanding you.

But I've heard that the reason we don't have 5.2 is because it would need to be rewritten to match Roblox, security issues would need to be removed again, et cetera. Or at least I'm pretty sure I remember hearing that somewhere.
Report Abuse
Alyte is not online. Alyte
Joined: 24 Oct 2011
Total Posts: 10090
30 Oct 2014 01:10 PM
Is it just me or not only would both code snippets print '2' but both are also possible in 5.1.4
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
30 Oct 2014 01:52 PM
I tested it in the command bar, he is actually correct. It prints 0.
Report Abuse
Alyte is not online. Alyte
Joined: 24 Oct 2011
Total Posts: 10090
30 Oct 2014 02:11 PM
Oh I forgot (string keys)
Report Abuse
qzok is not online. qzok
Joined: 27 Oct 2014
Total Posts: 39
30 Oct 2014 08:13 PM
this can already be done in 5.1
if they updated to 5.2, they would probably need to re-restrict every unsafe method and limit some of the api
Report Abuse
noliCAIKS is not online. noliCAIKS
Joined: 08 Mar 2010
Total Posts: 917
01 Nov 2014 07:39 AM
The problem is that in 5.1.4, metamethods are only called when the normal behavior is unavailable/undefined, with table + table or #userdata. However, #table is well defined, so it doesn't check for the metamethod.
This behavior was changed in 5.2, and now the __len and __gc metamethods are always checked even if they are defined, like in the case of tables. I think __index still behaves the way it used to though, in that it is only used if the requested key does not exist in a table.
Report Abuse
Everment is not online. Everment
Joined: 08 Oct 2009
Total Posts: 6020
01 Nov 2014 12:53 PM
Yes, and anything that even touches fenv would break.

There's a reason that we're not on 5.2 anyway.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
01 Nov 2014 06:35 PM
I am curious as to what that reason is.
Report Abuse
mooing is not online. mooing
Joined: 28 Apr 2009
Total Posts: 79
01 Nov 2014 07:25 PM
Because it's slower.
Report Abuse
j1my3p1x is not online. j1my3p1x
Joined: 16 Jan 2010
Total Posts: 978
01 Nov 2014 08:46 PM
@mooing
5.2 luajit pls
Report Abuse
mooing is not online. mooing
Joined: 28 Apr 2009
Total Posts: 79
01 Nov 2014 10:02 PM
Just googled it. If you think Roblox is adding JAVA you're an idiot. :S
Report Abuse
j1my3p1x is not online. j1my3p1x
Joined: 16 Jan 2010
Total Posts: 978
01 Nov 2014 10:54 PM
luajit isnt java, its a lua runtime
Report Abuse
qzok is not online. qzok
Joined: 27 Oct 2014
Total Posts: 39
02 Nov 2014 03:31 PM
^ Dumbass Lol
Report Abuse
noliCAIKS is not online. noliCAIKS
Joined: 08 Mar 2010
Total Posts: 917
04 Nov 2014 09:44 AM
^ Who exactly is the dumbass? There are a lot of dump people above the caret and the post about luajit being unrelated to Java was correct: it's in fact a 'just-in-time' compiler which compiles Lua bytecode to machine bytecode for faster execution.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image