Skip to content

Instantly share code, notes, and snippets.

@doyousketch2
Created June 2, 2019 16:02
Show Gist options
  • Select an option

  • Save doyousketch2/4f3d32628263e25302525f27a397f569 to your computer and use it in GitHub Desktop.

Select an option

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

mase76 commented Dec 26, 2020

Copy link
Copy Markdown

This example causes an overheat after a few seconds.

@doyousketch2

Copy link
Copy Markdown
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

mase76 commented Dec 27, 2020

Copy link
Copy Markdown

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