Skip to content

Dev: TODO

Thomas Depke edited this page Jan 17, 2023 · 4 revisions

Lua and OpenComputers Tips

  • In Lua, mixed tables (sequential integer keys and string keys) are generally a bad practice. Try to avoid.
  • The OpenComputers thread library is implemented using coroutines (Lua is not natively multithreaded). A context switch between these "threads" can only happen during a computer.pullSignal() call (or event.pull() and os.sleep() since they call this function).
    • This means that if a process is making some non-direct calls to components (such as telling a transposer to transfer items), events like user input will be delayed.
    • The pull signal call needs to happen occasionally during the program. There is only a handful of seconds that a program is allowed to run without yielding before the mod's tick handler kills it.
  • The reboot command does not power cycle a computer! To safely unload and reload the Lua environment on a machine, make sure to physically power it off (with the power button) and back on again.

Notes

  • Interesting discovery(?): seems like the text reordering problem in programs with the command thread pattern (specifically oc_energistics) may be caused by io.read() mixed with writing. Could get around this by having enter key enable input (ctrl+d to disable)?

Future Project Ideas

  • Drone logistics, just like logistics robots in Factorio. This would be used for oc_energistics too.
  • Portable ore density scanner, uses a tablet with a geolyzer.
  • Drone follower, it could help carry stuff (or just be a pet, like Robit from Mekanism).
  • Modular hologram displays (connect multiple together for a larger hologram). Could have some fancy 3D graphics renders if performance will allow it.

General Tasks

TODO
  • Finish testing of some mostly-finished programs (like minibuilder and tgol) and mark these as done. These don't need a fancy readme page.
  • Lots of FIXMEs and TODOs in the code, I wonder who keeps adding them? Hmm.
  • Plenty of work left to do on oc_energistics, ocvnc, and tminer. Need to at least get oc_energistics torch crafting demo back up and running.
  • Split up files in libdstructs so they can be included in programs separately. Clean up tests and bitset too.
  • More work to do in libmatrix.
  • Add README for xprint.
DONE
  • Just reorganized files, shit got hella broke.
    • I think we good?
  • Was working on new libapptools file called app.lua for common app stuff in ocvnc, add a new reciprocal action stack doodle for cleanup lol
  • Add dlog enum for debugging levels, set in apps for easy debug/release testing
  • Bug: include lib seems to be having a problem. To reproduce have a maxMessageLength set in dlog, run storage app, change maxMessageLength through lua prompt, and run storage again.
  • Plz add "status" for oppm_linker
    • On second thought, it doesn't really seem that worth it.
  • Need to update simple_doc to support annotations, new @func one to let simple_doc know how to insert them?
  • May want to reorganize lib files, take some inspiration from https://github.com/OpenPrograms/mpmxyz-Programs
    • Could put stuff in "/usr/lib/td" and rename packages to "td." for library specific stuff. Could be a harmful/painful change to update module paths, renaming the packages was a good idea though.
  • Potential bug in include.lua: if the lua prompt is started during a fresh boot, a module imported, then the prompt is exited and the same module gets added with include() in a script, the script's version will not get reloaded.
    • The problem is that include will assume a module is a system one if it finds it already loaded, we could fix this by adding all system modules to tracking? probably need to assume that some loaded modules will not be found as files and they should get a special timestamp or something.
    • Fixed for now by adding warning message when previously loaded module is included.

Clone this wiki locally