95 posts
Location
A CPU some where in Bolton, UK
Posted 04 April 2016 - 11:39 PM
Hi all,
I am wanting to interact with a powered spawner from MFR, when calling "getStackInSlot" it returnes a function eg "Function : 77583f51"
This changes everytime aswell so how can i make this into a readable line so my auto detect function reads what is in the spawner and then dislpays it?
Any help will be appreciated :P/>
Edited on 04 April 2016 - 09:40 PM
8543 posts
Posted 04 April 2016 - 11:48 PM
Please post your code. You are likely not calling the function.
95 posts
Location
A CPU some where in Bolton, UK
Posted 04 April 2016 - 11:50 PM
Please post your code. You are likely not calling the function.
Currently not using my own code, using a test code at the moment but here it is
for i,v in ipairs(peripheral.getMethods("powered_tile_0"))
do print(i..". "..v)
end
sp = peripheral.wrap("powered_tile_0")
print(sp.getTankInfo)
8543 posts
Posted 04 April 2016 - 11:55 PM
You are not calling the function.
print(sp.getTankInfo())
95 posts
Location
A CPU some where in Bolton, UK
Posted 05 April 2016 - 12:00 AM
You are not calling the function.
print(sp.getTankInfo())
Now it returnes a table number?
Edited on 04 April 2016 - 10:00 PM
3057 posts
Location
United States of America
Posted 05 April 2016 - 12:15 AM
Print the contents of the table.
95 posts
Location
A CPU some where in Bolton, UK
Posted 05 April 2016 - 12:39 AM
Print the contents of the table.
:o/> How? I cant remember LOL!
7083 posts
Location
Tasmania (AU)
Posted 05 April 2016 - 01:13 AM
95 posts
Location
A CPU some where in Bolton, UK
Posted 06 April 2016 - 09:47 PM
So i managed to sort the table thing out however if i want to print out what the stack name is, what would i do?
8543 posts
Posted 07 April 2016 - 01:04 AM
What do you mean by "stack name"?
7083 posts
Location
Tasmania (AU)
Posted 07 April 2016 - 01:28 AM
This guide should help you deal with individual table keys. You may also find
this thread helpful.
95 posts
Location
A CPU some where in Bolton, UK
Posted 08 April 2016 - 06:44 PM
This guide should help you deal with individual table keys. You may also find
this thread helpful.
Ok well i still done understand, let me explain so you full understand and can help :P/>
Im using MFR spawner with networking cable to get the name of the mob in the safari net, the code im using atm to get the data is
for i,v in ipairs(peripheral.getMethods("powered_tile_0"))
do print(i..". "..v)
end
sp = peripheral.wrap("powered_tile_0")
local test = textutils.serialize(sp.getStackInSlot(1))
print(test)
In which returns this
http://imgur.com/b8FwAGOwhen looking at the forum post you linked i tried this
local test = textutils.serialize(sp.getStackInSlot(1))
print(test[2].captured)
However all this did was "attempt to index ? (a nil value) I really dont understand, i have never done this kind of work with tables before
3057 posts
Location
United States of America
Posted 08 April 2016 - 07:18 PM
That should be
print( test.safari_net.captured )
95 posts
Location
A CPU some where in Bolton, UK
Posted 08 April 2016 - 07:19 PM
That should be
print( test.safari_net.captured )
tried this after i made the last comment and i still get the same error
3057 posts
Location
United States of America
Posted 08 April 2016 - 07:20 PM
*facepalm*
Didn't notice you were attempting to treat the serialized (eg string) table as a table. Try using the table directly.
95 posts
Location
A CPU some where in Bolton, UK
Posted 08 April 2016 - 07:21 PM
*facepalm*
Didn't notice you were attempting to treat the serialized (eg string) table as a table. Try using the table directly.
What do you mean table directly?
3057 posts
Location
United States of America
Posted 08 April 2016 - 07:22 PM
print( sp.getStackInSlot( 1 ).safari_net.captured )
95 posts
Location
A CPU some where in Bolton, UK
Posted 08 April 2016 - 07:26 PM
print( sp.getStackInSlot( 1 ).safari_net.captured )
YES, that worked! thank you!