Re: Difference Between Lua 5.1.4 and LuaJIT-2.0.0

  • From: Szabó Antal <szabo.antal.92@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 7 Jan 2013 18:25:45 +0100

2013/1/7 Daniel Slaney <Daniel.Slaney@xxxxxxxxxxxxxxxxxxxx>:
> The following gives different results in LuaJIT
>
>> t = {}
>> print(#t)
> 0
>> t[2] = true
>> print(#t)
> 0 -- Lua 5.1.4
> 2 -- LuaJIT-2.0.0 (with -j off as well)
>
> Is this intended or have I messed up something with my install?

Please read this: http://www.lua.org/manual/5.1/manual.html#2.5.5

It's not *intended*, just differently implemented in lua and luajit,
but both behaviours sre correct.

Other related posts: