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

  • From: Paul K <paul@xxxxxxxxxxxxx>
  • To: "zerobrane@xxxxxxxxxxxxx" <zerobrane@xxxxxxxxxxxxx>
  • Date: Fri, 31 Oct 2014 09:42:29 -0700

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/

Other related posts: