[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: a weird bug with pack & unpack
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 12 Nov 2012 21:38:35 +0200
2012/11/12 spir <denis.spir@gmail.com>:
> I have no luajit and only one lua, no 5.1 afaik. My exec command for lua
> code is just lua "%f". /usr/bin/lua is well a symlink (to another symlink, I
> guess, in etc/alternatives/, don't know more).
>
> spir@ospir:~$ which lua
> /usr/bin/lua
> spir@ospir:~$ lua -v
> Lua 5.2.0 Copyright (C) 1994-2011 Lua.org, PUC-Rio
Lua 5.2 has only table.pack and table.unpack.
Lua 5.1 has only unpack. Instead of table.pack(...)
5.1 prgrams use {...}. Only difference is that table.pack
sets a field `n` telling how many things (including nils)
were packed. You can't get that info from {...}. However,
programs written for 5.1 do not rely on this feature.
I usually put
unpack = unpack or table.unpack
when I am about to run old code under 5.2.
It may work, or it may stutter at a different incompatibility.