0 Members and 1 Guest are viewing this topic.
_QUEUE = {}function setTimeout(func, ms, toggle) ms = ms>9 and ms or 10 table.insert(_QUEUE, {start=timer.getMilliSecCounter(), time=ms, toggle=toggle, action=func}) if toggle then timer.start(0.01) endendfunction on.timer() local now = timer.getMilliSecCounter() for index, t in ipairs(_QUEUE) do if now>=t.start+t.time then t.action() if t.toggle then timer.stop() end end endend
turn = (turns[2] == 1 and math.random() < .5) and "o" or "x"
color = side == "x" and "Black" or "White"
Thanks guys! Hey adriweb! I was looking through your optimized version and I found statements likeCode: [Select]turn = (turns[2] == 1 and math.random() < .5) and "o" or "x"andCode: [Select]color = side == "x" and "Black" or "White"Could you explain how that works?
var = A and B or C
if A then var = Belse var = Cend
toto = bool1toto = bool1 or bool2 -- if bool1, then bool1toto = bootl1 and bool2 -- if bool1, then bool2toto = bool1 and bool2 or bool3 -- if bool1 then (bool2 or bool3) seen previouslytoto = bool1 and bool2 and bool3 and bool4 or bool5 or bool6 -- if bool1 and bool2 and bool3 and bool4 and bool5 then bool6