lua-users home
lua-l archive

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


On 12/11/2012 18:15, Matthew Wild wrote:
On 12 November 2012 16:41, spir <denis.spir@gmail.com> wrote:
I have a set of everyday tools, mainly tiny funcs one of which uses table
pack & unpack. This func works very fine, it is exhaustively tested
--locally. When I use it from other program files, I often get an error
telling that Lua does not find the field (or global) 'pack' --
_sometimes_; and all works fine, _sometimes_. If I replace pack with a
workaround, then I get the same issue about unpack. I cannot find any logic.

The same happens (works or not) whether pack & unpack are denoted on the
table 'table' or under aliases (just the 'table.' prefix removed). I have
checked several times that nothing in my present project files uses such
names, or modifies table, except for adding a few 'methods' like table copy.
Dunno. I'm highly frustrated of not getting the logic and annoyed because
the func in question is a very practicle debugging tool I constantly use.

Lua 5.2.1 on linux (lubuntu)

Any chance it's a case of accidentally using Lua 5.1 or LuaJIT in the
cases where it doesn't exist? I doubt the existence of a bug in Lua
itself where functions can go missing from tables :)

Regards,
Matthew

I doubt as well! I would not even suggest it, if only by experience (the benefits of age, you know). 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

Anyway:

spir@ospir:~$ which lua5.2
/usr/bin/lua5.2
spir@ospir:~$ which lua5.1
spir@ospir:~$

So, I guess it's safe to say we're talking about 5.2.
Also (which also shows it's well 5.2), when just creating a test file and typing the above, all works fine. It's only in given circumstances I find myself unable to diagnose and distinguish (reason for my post for help) that the bug happens. There is certainly, thus, something on my side, in my code.

Denis