I'm working on a project where the end-users will be running Lua, and communicating with a server written in Python, but I can't find a way of doing what I need to do in Lua.
I give the program an input of:
recipient command,argument,argument sender
I get an output of a list containing:
{"recipient", "command,argument,argument", "sender"}
Then, separate those items into individual variables. After that, I'd separate command,argument,argument
into another list and separate those into variables again.
How I did it in Python:
test = "server searching,123,456 Guy" #Example
msglist = test.split()
recipient = msglist.pop(0)
msg = msglist.pop(0)
id = msglist.pop(0)
cmdArgList = cmd.split(',')
cmd = cmdArgList.pop(0)
while len(cmdArgList) > 0:
argument = 1
locals()["arg" + str(argument)]
argument += 1
The question in your title is asking for something very specific: the Lua equivalent of getting a value from an array and removing it. That would be:
theTable = {}; --Fill this as needed
local theValue = theTable[1]; --Get the value
table.remove(theTable, 1); --Remove the value from the table.
The question you ask in your post seems very open-ended.