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

Command problem

Question

4 answers to this question

Recommended Posts

  • 0

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...

Link to post
Share on other sites
  • 0
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

 

Link to post
Share on other sites
  • 0

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())

 

Link to post
Share on other sites
  • 0
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 :)

Link to post
Share on other sites

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.