Code: Select all
local clock = os.clock
~~~~
function sleep(n)
local t0 = clock()
while clock() - t0 <= n do end
end
~~~~
function widget:MousePress(mx,my,mb)
if (mb == 2) then
middledown = clock()
repeat
Spring.Echo('blabla')
sleep(0.05)
until ((clock() - middledown) > 0.25)
end
end
I've got more than a few wild guesses why this might be happening, but I'm just frustrating myself and wasting time by endlessly rewriting the above code in different ways. For all I know it could simply be a mouse input bug, as was the culprit with some other things I've become familiar with recently.
Can someone help me understand what I'm doing wrong here?
Really enjoying this, by the way. I feel like I'm back in school, running into things that I can't do due to lack of knowledge rather than lack of time. I guess I could say it's refreshing... I'm not saying this to say "look at what a super-genius I am", but I really appreciate things that genuinely challenge my creativity rather than my attention span.