From
Lua 5.3 Reference Manual[
^]:
os.clock ()
Returns an approximation of the amount in seconds of CPU time used by the program.
It doesn't seem to me the most appropriate function for implementing a delay.
Try
local function wait(seconds)
local tend = os.time() + seconds
while os.time() < tend do
end
return seconds
end
local returnedWait = wait(10)
print(returnedWait)
while true do
wait(10)
print("this is printing every 10 seconds")
end
Please note, in order to obtain tinier time intervals, you have to call underlying OS (specific) functions.