8 posts
Posted 30 October 2012 - 07:52 PM
I was wondering, Would it be possible to clear a function as i'm trying to do a timing system.
print("Login Duration: "..logindur()) -- Logindur needs to be cleared to make sure that the number can increase
function logindur()
i = ""
shell.run("clear") -- Wont this clear the whole screen?
i=i+1
print(i)
sleep(0.25)
end
Thanks..
-RevolutionLite
2217 posts
Location
3232235883
Posted 30 October 2012 - 09:28 PM
i dont really understand what you are trying to do :s
2005 posts
Posted 31 October 2012 - 07:23 AM
Pass i as an argument to logindur and only initialize it if it isn't already initialized. Then return i at the end. So:
function logindur(i)
i = i or ""
shell.run("clear") -- Wont this clear the whole screen?
i = i+1 --Um, you initialized i as a string, so this probably isn't a good idea
print(i)
sleep(0.25)
return i end
Then when you call logindur to alter i, use i = logindur(i) so that the alteration of i inside of the function is saved outside the function.
8 posts
Posted 31 October 2012 - 10:06 AM
Pass i as an argument to logindur and only initialize it if it isn't already initialized. Then return i at the end. So:
function logindur(i)
i = i or ""
shell.run("clear") -- Wont this clear the whole screen?
i = i+1 --Um, you initialized i as a string, so this probably isn't a good idea
print(i)
sleep(0.25)
return i end
Then when you call logindur to alter i, use i = logindur(i) so that the alteration of i inside of the function is saved outside the function.
Pass i as an argument to logindur and only initialize it if it isn't already initialized. Then return i at the end. So:
function logindur(i)
i = i or ""
shell.run("clear") -- Wont this clear the whole screen?
i = i+1 --Um, you initialized i as a string, so this probably isn't a good idea
print(i)
sleep(0.25)
return i end
Then when you call logindur to alter i, use i = logindur(i) so that the alteration of i inside of the function is saved outside the function.
, Well I've removed it atm.. I'll properly re-add it later
Mega fail x.x