|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 30 Oct 2014 01:52 PM |
| I tested it in the command bar, he is actually correct. It prints 0. |
|
|
| Report Abuse |
|
|
Alyte
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 10090 |
|
| |
|
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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 01 Nov 2014 06:35 PM |
| I am curious as to what that reason is. |
|
|
| Report Abuse |
|
|
mooing
|
  |
| Joined: 28 Apr 2009 |
| Total Posts: 79 |
|
| |
|
j1my3p1x
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 978 |
|
| |
|
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
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 978 |
|
|
| 01 Nov 2014 10:54 PM |
| luajit isnt java, its a lua runtime |
|
|
| Report Abuse |
|
|
qzok
|
  |
| Joined: 27 Oct 2014 |
| Total Posts: 39 |
|
| |
|
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 |
|
|