Skip to content

Instantly share code, notes, and snippets.

@doyousketch2
Created June 2, 2019 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doyousketch2/4f3d32628263e25302525f27a397f569 to your computer and use it in GitHub Desktop.
Save doyousketch2/4f3d32628263e25302525f27a397f569 to your computer and use it in GitHub Desktop.
Use interrupt to create a delay in Minetest Luacontrollers
local delay = 1
if event.type == 'program' then
interrupt( delay, 'Once' )
interrupt( delay, 'Loop' )
end
if event.type == 'interrupt' then
if event.iid == 'Once' then
print( 'Run once' )
elseif event.iid == 'Loop' then
print( 'over and over' )
interrupt( delay, 'Loop' )
end
end
@mase76
Copy link

mase76 commented Dec 26, 2020

This example causes an overheat after a few seconds.

@doyousketch2
Copy link
Author

yea, it was to illustrate the difference between those two methods to somebody on Discord. They were having the same issue; having it loop then overheat, when it should have only run once.

That would depend on your server and your uses. Try increasing the delay to reduce the chance of it happening. Otherwise, rebuild machine, or tweak server settings.

@mase76
Copy link

mase76 commented Dec 27, 2020

I found out that an activated modlib causes the overheating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment