Skip to content

Instantly share code, notes, and snippets.

@doyousketch2
Created June 2, 2019 16:02
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