News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.

Post Reply  Post Thread 
[WIP] MurgaLua Reference Tool
Author Message
Senior Member

Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
RE: [WIP] MurgaLua Reference Tool

I don't understand why the arg table doesn't work in the binary, since it's standard Lua. Perhaps there is a problem with the compiler.

Before starting to run the script, lua collects all arguments in the command line in a global table called arg. The script name is stored at index 0, the first argument after the script name goes to index 1, and so on. Any arguments before the script name (that is, the interpreter name plus the options) go to negative indices. For instance, in the call

$ lua -la b.lua t1 t2

the interpreter first runs the file a.lua, then creates a table

arg = { [-2] = "lua", [-1] = "-la",
[0] = "b.lua",
[1] = "t1", [2] = "t2" }

and finally runs the file b.lua. The script is called with arg[1], arg[2], as arguments; it can also access these arguments with the vararg expression '...'.

02-02-2008 01:15 PM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
[WIP] MurgaLua Reference Tool - mikshaw - 07-10-2007, 05:00 PM
RE: [WIP] MurgaLua Reference Tool - mikshaw - 02-02-2008 01:15 PM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: