Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • Announcements

    • Lizzy Trickster

      Latest Stable OpenComputers Version   11/26/16

      The latest released version of OpenComputers is version 1.7.1 for MC 1.7.10, 1.10.2, 1.11.2 & 1.12.1. See more information here! Beta/Dev builds can be found at the Jenkins Build Server (ci.cil.li)

thearhar

Members
  • Content count

    3
  • Joined

  • Last visited

  1. Create infinite thread in background and continue

    Thank you, now it is clear, detached thread continue to run even after last line of main executed and main closed
  2. Create infinite thread in background and continue

    Thank you all for suggestions, I managed to improve my program Now it is https://pastebin.com/SszMjEfh Video:
  3. What I'm trying to do is IC2 reactor control with some graphic interface: It draws components durability status, contorls overheating and reads event from keyboard to switch power. But what happening now is until it draw all components, that takes forever and is painfully slow, it will not react to any event, and will not check overheating What I want to do is create thread that draws components and continue main program to listen events and check overheating Now I have this code: https://pastebin.com/BBw1TxYd I tried to use threads api, but it seems you can not create infinite while-true-loop thread and continue main function: td=thread.create(function() while true do checkDmg() end end):detach() --NEVER GETS HERE while handleEvent(event.pull(1)) do --nothing end ** I cant understand nothing about what detach actually do, documentation needs to be extended As I understand, there is absolutely no way to do what I'm trying to do in lua? Basically I need to be able to interrupt my code that draws things at any moment by pressing key
×