[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Compatible coding: 'arg' in 5.1 vs 5.2
- From: Leo Razoumov <slonik.az@...>
- Date: Fri, 3 Jun 2011 17:59:26 -0400
On Fri, Jun 3, 2011 at 06:47, steve donovan <steve.j.donovan@gmail.com> wrote:
> On Fri, Jun 3, 2011 at 12:25 PM, Dirk Laurie <dpl@sun.ac.za> 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 {...}?
The following script show the difference
-- test.lua (Lua-5.1)
print("arg[0]", '=', arg[0])
print("({...})[0]", '=', ({...})[0])
----
Output:
arg[0] = test.lua
({...})[0] = nil
--Leo--