Ulysses
General => Off-Topic => Topic started by: assface33 on August 15, 2016, 03:25:39 PM
-
I'm trying edit some code for a garry's mod addon and I try this
function (this part doesn't matter)
local i = 1
if i<11 then
(code stuff line 1)
(code stuff line 2)
i = i + 1
end
but it doesn't work. If someone could tell me what I should do and why mine doesn't work I'd really appreciate it.
-
If you're calling that function repeatedly and expecting it to count, it's always assigning i = 1
If you're expecting it to loop, you have no loop statement (http://www.tutorialspoint.com/lua/lua_loops.htm).
(Tons of lua tutorials, I just picked that one out of hundreds of google search found pages)
-
Defining "doesn't work" would be nice. Knowing your use case means we can help you more accurately and not just provide broad solutions.
Also, I don't know if this was from cropping out code or whatever, but you're missing an end to close that if statement.