lua-users home
lua-l archive

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

On 3 June 2011 22:59, Leo Razoumov <> wrote:
> On Fri, Jun 3, 2011 at 06:47, steve donovan <> wrote:
>> On Fri, Jun 3, 2011 at 12:25 PM, Dirk Laurie <> wrote:
>>> Which is better?
>> I would say: avoid the local 'arg' like the plague, it's a Lua 5.0 -ism ;)
> I aways wondered how to get arg[0] (name of the current script) with {...}?

You can use the *global* 'arg' for command-line parameters. So arg[0]
is just fine.

The issue is that in 5.0, '...' did not exist inside functions, and a
magic 'arg' local appeared containing the function arguments instead.
This is deprecated in 5.1 in favour of '...' - it only works because
the Lua makefile enables deprecated features by default (to ease
transition to new versions). It's been known since the release of 5.1
that magic 'arg' would be gone entirely in 5.2.