83 posts
Location
I 'm inside your brian
Posted 28 May 2014 - 03:17 PM
Hey guys :)/> I am asking a pro how to make an arguments.. this is what I do and can you please help me :)/>
function printUsage()
print("Usage: file -find [(File Name)]")
end
local tArgs = { ... }
if #tArgs < 1 then
printUsage()
end
local aText
local sCommand = tArgs[1]
if sCommand == "-find" then
if #tArgs >= 2 then
--- aText = tochar
83 posts
Location
I 'm inside your brian
Posted 28 May 2014 - 03:28 PM
This is the updated version :)/>
function printUsage()
print("Usage: file -find [(File Name)]")
end
local tArgs = { ... }
if #tArgs < 1 then
printUsage()
end
local sCommand = tArgs[1]
if sCommand == "-find" then
local sPath = shell.resolve( tArgs[2] )
local tFiles = fs.find( sPath )
if #tFiles > 0 then
for n,sFile in ipairs( tFiles ) do
if fs.exists( sFiles ) then
print("File Exists!")
end
end
else
printError( "No matching Files" )
end
end
157 posts
Posted 28 May 2014 - 03:28 PM
From what I understand, if you're trying to get a program's arguements, then you can call your table name anything not necesserily tArgs, the triple dot represents all the arguements passed to the program seperated by commas, so if you have arguements such as 123 "hello" "there", the value of the … will be 123, "hello", "there". If you put this into a table with curly brackets it will become {123, "hello", "there"}, what exactly do you need help with, what are you trying to create?
83 posts
Location
I 'm inside your brian
Posted 28 May 2014 - 03:32 PM
From what I understand, if you're trying to get a program's arguements, then you can call your table name anything not necesserily tArgs, the triple dot represents all the arguements passed to the program seperated by commas, so if you have arguements such as 123 "hello" "there", the value of the … will be 123, "hello", "there". If you put this into a table with curly brackets it will become {123, "hello", "there"}, what exactly do you need help with, what are you trying to create?
creating a search file for my first program :)/>
Nevermind xD.. I fixed it already but thanks anyways :D/>..