[ZeroBrane Studio] Re: Command line parameters in Debug mode

  • From: Ildar Mulyukov <ildar.mulyukov@xxxxxxxxx>
  • To: zerobrane@xxxxxxxxxxxxx
  • Date: Mon, 3 Nov 2014 11:09:35 +0600

Right! Thanks, Paul.
It seems that the book I appreciate "Beginning Lua Programming" by Kurt
Jung and Aaron Brown is a little misleading: section "Scripts as Vararg
Functions" only says about {...}, but not the `arg` table.
Fixed my script.

Best regards, Ildar

On Fri, Oct 31, 2014 at 10:42 PM, Paul K <paul@xxxxxxxxxxxxx> wrote:

> Hi Ildar,
>
> > Pushing F6 gives "1" (right)
> > Pushing F5,F5 gives "0" (wrong)
> > Bug?
>
> From the manual (Lua 5.2): "Vararg expressions, denoted by three dots
> ('...'), can only be used when directly inside a vararg function; they
> are explained in §3.4.10." and "Before starting to run the script, lua
> collects all arguments in the command line in a global table called
> arg." and "it can also access these arguments with the vararg
> expression '...'."
>
> Unfortunately, the latter "also access"part doesn't work in the case
> you are showing as I have no way to assign something to the vararg
> expression (without wrapping the chunk into a function, but this
> creates some other issues).
>
> So, it may deem to be a bug that I can't do much about. If you use
> "arg" instead of {...}, you should get the same result in both cases.
>
> Paul.
>
> On Thu, Oct 30, 2014 at 11:08 PM, Ildar Mulyukov
> <ildar.mulyukov@xxxxxxxxx> wrote:
> > Hi!
> > As Paul proposed, next question comes to the ML :)
> > A Lua script as simple as can be:
> >> local args = {...}
> >> print(#args)
> > Changing Project -> Command line parameters to "123"
> > Pushing F6 gives "1" (right)
> > Pushing F5,F5 gives "0" (wrong)
> >
> > Bug?
> > Best regards,
> > --
> > Ildar Mulyukov,
> > child of God
> >
> > email: ildar.mulyukov@xxxxxxxxx
> > GoogleTalk: ildar.mulyukov@xxxxxxxxx
> > blog: http://johan-notes.blogspot.com/
>
>


-- 
Ildar Mulyukov,
child of God

email: ildar.mulyukov@xxxxxxxxx
GoogleTalk: ildar.mulyukov@xxxxxxxxx
blog: http://johan-notes.blogspot.com/

Other related posts: