Alright. I know how to grab arguments when the program is run, tArgs and all that, but is there any way to grab text with io.read() or something, then look for arguments in that? Thanks.
Grabbing Arguments
Started by Csstform, Apr 23 2014 03:18 PM
4 replies to this topic
#1
Posted 23 April 2014 - 03:18 PM
#2
Posted 23 April 2014 - 04:25 PM
Check out the string library.
http://lua-users.org...LibraryTutorial
Once you have your string you can use functions like string.match() to search for words or patterns.
http://lua-users.org...LibraryTutorial
Once you have your string you can use functions like string.match() to search for words or patterns.
#3
Posted 23 April 2014 - 04:46 PM
Check out how the shell splits them out of the command string if you're looking for similar functionality.
#4
Posted 23 April 2014 - 07:01 PM
Here's a little function that I threw together
function getArguments( mask )
local args = {}
local input = read( mask )
for word in input:gmatch("%S+") do
table.insert( args, word )
end
return args
end
But you should check out this code and the lua wiki aswell to get a better understanding of it.
#5
Posted 23 April 2014 - 09:10 PM
Thanks, guys!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











