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

Command problem

Question

Posted

I have tried to make a program that uses Open Computers Refined Storage Driver mods command getItems(). But when im trying to print test when Local is test = rs.getItems. But then it returns "table: 0x41c2700" what im doing wrong

Here is the code:2017-02-11_18.13.40.png

4 answers to this question

Recommended Posts

  • 0
Posted

The table is being turned into a string. Lua doesn't know how to do this in a meaningful way by default. What you want are the table keys and its values. Try this out and see if its what you're looking for.

for k, v in pairs(test) do

  print( k, tostring(v) )

end

Sorry for the crap formatting. Phone...

  • 0
Posted
25 minutes ago, Molinko said:

The table is being turned into a string. Lua doesn't know how to do this in a meaningful way by default. What you want are the table keys and its values. Try this out and see if its what you're looking for.

for k, v in pairs(test) do

  print( k, tostring(v) )

end

Sorry for the crap formatting. Phone...

this is the result i don't think it worked

here's the resultScreenshot_26.png

 

  • 0
Posted

oh but it did work. rs.getItems() returns a list(table). I assume you have 505 of something in your storage... The list returned has data(as a table) in each index. Look at it like this...

local function dumpSlot(n, items)
	local info = items[ n ]
	for k, v in pairs( info ) do
		print( k, v )
	end
end

-- look at details of slot 1 in list of items returned by rs.getItems()
dumpSlot(1, rs.getItems())

 

  • 0
Posted
2 minutes ago, Molinko said:

oh but it did work. rs.getItems() returns a list(table). I assume you have 505 of something in your storage... The list returned has data(as a table) in each index. Look at it like this...


local function dumpSlot(n, items)
	local info = items[ n ]
	for k, v in pairs( info ) do
		print( k, v )
	end
end

-- look at details of slot 1 in list of items returned by rs.getItems()
dumpSlot(1, rs.getItems())

 

yes it worked thanks :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

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