jdksh 0 Posted November 13, 2023 Share Posted November 13, 2023 Im trying to control a nuclearcraft reactor with the rc api and threading, but when i run it freezes the whole pc function start() local thread = require("thread") t = thread.create(function() local component = require("component") local r = component.nc_fusion_reactor while(true) do if(r.getEfficiency() < 100) then r.activate() else r.deactivate() end end end):detach() end function stop() t:kill() end Quote Link to post Share on other sites
0 welbre 0 Posted February 7 Share Posted February 7 You need to yield the thread, use os.sleep function in while loop block. Quote Link to post Share on other sites
Im trying to control a nuclearcraft reactor with the rc api and threading, but when i run it freezes the whole pc
Link to post
Share on other sites