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

Crafter38

Members
  • Content Count

    9
  • Joined

  • Last visited

Posts posted by Crafter38

  1. 1 hour ago, cadergator10 said:

    I think the only way to do that is a foreach loop. If that loop is named myTable, then

    
    
    for key, value in pairs(myTable) do
    	print(value)
    	print(myTable[key])
    end

    both of these print the same thing for each element in the table

    I tried your code in the game and that's I have got:

    2.jpg

  2. 6 hours ago, cadergator10 said:

    {["su"] = 222, ["su2"] = 333}

    Thank you so much! I didn't know about this notation. Now works perfectly. Let's assume that I know nothing about the content of the tank_controller component. So how do I get all the parameters of it with

    for 1, 5 do
    	print()
    end

     cycle for example? How do I put strings (e.g. "amount") into indexes of this cycle?

  3. On 5/28/2014 at 4:23 AM, Sangar said:

    I'm thinking of making <sneak>[+ctrl?]+<using/right clicking> with a card component in hand copy the address to the clipboard, will have to see how that works out.

    That would be awsome! It's a little time consuming to print addresses of modems by hand.

  4. First of all, thank you, Sangar and other developers, for updating this incredible mod! I love it!

    So I tried to print values of table (just in educational purpose) which gives the method 

     component.tank_controller.getFluidInTank(4)

    4 is the left side of the Adapter where I put Tank Controller Upgrade. As I understand, this method contains so called "nested table". It gives us this:

    {{amount=1000, capacity=4000, hasTag=false, label="Water", name="water"}, {amoun=0, capacity=4000}}

    Ok, I tried to print nested table in ordinary Lua interpreter. This code works fine and prints 222:

    su=222
    su2 = 333
    th=452
    th2 = 349
    
    sec = {su, su2}
    third = {th, th2}
    first = {sec, third}
    
    print(first[1][1])

    But when I tried the same way  in the game I have got nil:

    co=component.tank_controller.getFluidInTank(4)
    print(co[1][1])

    By hard googling I finally found that if we print

    co=component.tank_controller.getFluidInTank(4)
    amount = co[1].amount

    then it's possible to get that value and print it (thanks Harkole!). But when I tried that way of getting value of nested table in Lua interpreter, I got nil:

    su=222
    su2 = 333
    th=452
    th2 = 349
    
    sec = {su, su2}
    third = {th, th2}
    first = {sec, third}
    
    print(first[1].su)

    As I understand getFluidInTank() gives some special type of nested table, which is impossible to print like "normal" nested tables? This is complete riddle and mystery for me, please enlighten me!

  5. Hi everybody! This is a great mod and I'm fond of it! Thanks developers, I hope that you will not abandon it!

    I'm trying to mine some blocks including dirt, cobblesnotes and coal. To do the task properly, different tools required, mainly shovel and axe. If my robot is dealing with stone how does it know what does it hold in it's hand? I mean in the box with wrench pic in the toolbelt. I looked up in Robot and Inventory_Contorller API-s but found nothing about getting the name of the tool. I understand that I may get the names of whatever tools in one of 16 boxes in internal inventory of robot, but what about the tool  robot holds right now? Is there a hidden api or may be some workaround to do that?

×
×
  • Create New...

Important Information

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