0

So I have not tried anything yet, but I know those code scripts wont work..
So my though was creating a program wich had some functions ex. rm, delete, mkdir and edit. So all of these programs have something in common, they all have an "exception", like a file name.. So I wondered how the programs actually can handle it, so what I though in the first place was something in an another language, but now what I think it would be in LUA as it is not is this:

Runned in shell: MyProgram run DNS_SERVER

MyProgram

local MyProgramexception = read(MyProgram {$0}:{$1}:{$2})

But it I guess it is not that simple, but what I need is something that run if statements for example like:

public $0 = {exception}
public $1 = {exception}
local run = ({$0}, run)
local del = ({$0}, rm)
local program = ({$1}, dns_server || web_server || other_things..)

This is of course some NON WORKING code as I tried to look as real as possible..


So I wondered if there is someone out there who actually knows this?


Also posted on Arqade, but it was off-topic somehow..


Mesbah Gueffaf
  • 518
  • 1
  • 7
  • 21

1 Answers1

0

It is a bit a vague question to me (and some vague non-lua code), but I think you mean program arguments, like this:

rename <argument1> <argument2>

To accomplish this, you can store all arguments in a table like this:

local arg = {...}

the ... does the magic. Now, you can access argument #1 by doing this:

arg[1]

I hope I have understood your question well.

RedPolygon
  • 63
  • 1
  • 9