Posted 19 May 2012 - 10:08 PM
I am just creating a small program to check what users have been created. At the top of this, I have a count (Users found: <variable>/4). However, I have not found a way to update that variable once the script runs past that point, which means if I +1 to the variable later in the script, it stays as 0/4.
The variable is called "count". I set it to 0 at the beginning, and then +1 it when it finds User 1. When I reprint the variable (for testing purposes) where it says "print(count)", it recognises that count = 1. But it doesn't update at the top, on line 4.
How do I update variables in a running script?
local count = "0"
print("Searching for users...")
sleep(1)
print("Users found: ",count,"/4")
if user1 == "" then
print("User 1 not found!")
sleep(1)
else
print("User: ",user1," found!")
count = count + 1
print(count)
sleep(1)
end
The variable is called "count". I set it to 0 at the beginning, and then +1 it when it finds User 1. When I reprint the variable (for testing purposes) where it says "print(count)", it recognises that count = 1. But it doesn't update at the top, on line 4.
How do I update variables in a running script?