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

scienceguy8

Members
  • Content Count

    1
  • Joined

  • Last visited

Posts posted by scienceguy8

  1. Forgive me if I'm making some obvious mistakes, but I've only just started playing with Lua about 6 hours ago.  Had some C/C++ classes in college years ago, but still.

    I'm playing on a 1.7.10 single player world with OpenComputers 1.6.0.9 (Feed The Beast Infinity with a couple extra mods on top).  I use level emitters to turn on and off machines and processes in my base.  Say, I need more of a particular Thaumcraft essentia (stored using Thaumic Energistics).  The level emitter goes high, a machine starts up and produces the essentia until there is enough, then the emitter goes low again.  Works great, but having all these level emitters around is driving me nuts and eating up valuable AE channels.  So, I want to use a single computer with an Interface on a ME Controller and a Redstone I/O where it is needed to act as 8 to 16 (or more) level emitters.

     

    Sudo code follows.

    while stop=0

    stop=redstone input (as soon as a redstone input is applied to the computer, break loop)

    essentiatable=getEssentiaInNetwork()

    extract data about essentiaType1 from essentiatable, write to variable Type1

    if Type1>some value, then emit redstoneBundle0 true, otherwise redstoneBundle0 false

    extract data about essentiaType2 from essentiatable, write to variable Type2

    if Type2>some value, then emit redstoneBundle1 true, otherwise redstoneBundle1 false

    ...

    extract data about essentiaType16 from essentiatable, write to variable Type16

    if Type16>some value, then emit redstoneBundle15 true, otherwise redstoneBundle15 false

    close while loop, return to top

     

    My problem is I can't wrap my head around tables.  I've tried executing print(component.me_controller.getItemsInNetwork()) a couple times on a static network (no items in or out), and get back a 16 digit string of 16 bit numbers.  Each time I run it, I get back a slightly different number.  I don't know how to decode it.  I don't know how to extract the data I need from it.  Because it is changing, even though the stacks of items in the network aren't, I can't quite be sure that it is even working correctly.  So how do you turn a table into usable information?  How do I make it readable?  Is there a function that easily takes a table and cuts it down to just the relevant parts you want?

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.