RE: Difference Between Lua 5.1.4 and LuaJIT-2.0.0

  • From: "Daniel Slaney" <Daniel.Slaney@xxxxxxxxxxxxxxxxxxxx>
  • To: <luajit@xxxxxxxxxxxxx>
  • Date: Mon, 7 Jan 2013 17:42:42 -0000

Thanks for the quick reply (and to Cosmin Apreutesei as well).

Live and learn.

-----Original Message-----
From: luajit-bounce@xxxxxxxxxxxxx [mailto:luajit-bounce@xxxxxxxxxxxxx] On 
Behalf Of Szabó Antal
Sent: 07 January 2013 17:26
To: luajit@xxxxxxxxxxxxx
Subject: Re: Difference Between Lua 5.1.4 and LuaJIT-2.0.0

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: