295 posts
Posted 22 August 2013 - 03:42 AM
Hi, I have this program,
http://pastebin.com/xwS2x1ab and I have this kind of loop
for i=1,5 do
--something
end
This loops 5 times.
I want it to accept an argument (for example "programName 10" will loop it 10 times
Thanks in advance,
Aden :)/>
1114 posts
Location
UK
Posted 22 August 2013 - 03:48 AM
local sTimes = ...
local timesToRepeat = tonumber(sTimes)
if timesToRepeat == nil then
print("That isn't a number")
error()
end
for i = 1, timesToRepeat do
-- Do something
end
Untested, written in browser.
BTW, it doesn't need to be called tArgs, it is just "t" for table, then "Args" for arguments. It's used by the CC devs.
295 posts
Posted 22 August 2013 - 05:32 AM
Thanks, Check out my pastebin for all my codes I wrote (Talked to someone who is very good at lua expecting to be told they are bad but was told they are quite good)
pastebin.com/u/ADENCRAFT20000I recommend you install my scripts via my installer by running
pastebin get 68JHikjS installer
then running
installer