Friday, 23 August 2013

Attempting to make a random choice in Lua

Attempting to make a random choice in Lua

This is what I have so far, but it seems that everytime I attempt to run
it, it closes.
function wait(seconds)
local start = os.time()
repeat until os.time() > start + seconds
end
function random(chance)
if math.random() <= chance then
print ("yes")
elseif math.random() > chance then
print ("no")
end
random(0.5)
wait(5)
end
That is the full context.

No comments:

Post a Comment