lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 12/11/2012 20:38, Dirk Laurie wrote:
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.

Thank you for the trick about unpack! Anyway, it does not solve my present issue because, when lua does not find pack, and I try using {...} as a workaround, it also does not find unpack (under either name). If it finds pack, it finds both (again, under either name)... I'm blocked on the issue. In the meantime, I removed a pair of tricks I did to "modularise" and "environ" my code files, in case it would help (but then, why?) but it did not help at all. Hum, I'm just thinking both projects presently working at use Löve. Maybe its libs play some tricks with Lua builtins which would cause the errors I observe; probably not in purpose, since we have full use of standard lua even on points (like filesystem) where it recommanded to use Löve modules, but possibly if ever it is not completely lua5.2-aware. Let us sees, I will ask on the forum (there are very competent lua programmers there).

Denis