Jump to content




Wired Modem Function Return


  • You cannot reply to this topic
17 replies to this topic

#1 Mr_Programmer

  • Members
  • 95 posts
  • LocationA CPU some where in Bolton, UK

Posted 04 April 2016 - 10: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 by Mr_Programmer, 04 April 2016 - 10:40 PM.


#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 04 April 2016 - 10:48 PM

Please post your code. You are likely not calling the function.

#3 Mr_Programmer

  • Members
  • 95 posts
  • LocationA CPU some where in Bolton, UK

Posted 04 April 2016 - 10:50 PM

View PostLyqyd, on 04 April 2016 - 10:48 PM, said:

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)


#4 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 04 April 2016 - 10:55 PM

You are not calling the function.

print(sp.getTankInfo())


#5 Mr_Programmer

  • Members
  • 95 posts
  • LocationA CPU some where in Bolton, UK

Posted 04 April 2016 - 11:00 PM

View PostLyqyd, on 04 April 2016 - 10:55 PM, said:

You are not calling the function.

print(sp.getTankInfo())

Now it returnes a table number?

Edited by Mr_Programmer, 04 April 2016 - 11:00 PM.


#6 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 04 April 2016 - 11:15 PM

Print the contents of the table.

#7 Mr_Programmer

  • Members
  • 95 posts
  • LocationA CPU some where in Bolton, UK

Posted 04 April 2016 - 11:39 PM

View PostKingofGamesYami, on 04 April 2016 - 11:15 PM, said:

Print the contents of the table.

:o How? I cant remember LOL!

#8 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 05 April 2016 - 12:13 AM

http://www.computerc...utils.serialize

#9 Mr_Programmer

  • Members
  • 95 posts
  • LocationA CPU some where in Bolton, UK

Posted 06 April 2016 - 08:47 PM

View PostBomb Bloke, on 05 April 2016 - 12:13 AM, said:

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?

#10 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 07 April 2016 - 12:04 AM

What do you mean by "stack name"?

#11 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 07 April 2016 - 12:28 AM

This guide should help you deal with individual table keys. You may also find this thread helpful.

#12 Mr_Programmer

  • Members
  • 95 posts
  • LocationA CPU some where in Bolton, UK

Posted 08 April 2016 - 05:44 PM

View PostBomb Bloke, on 07 April 2016 - 12:28 AM, said:

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/b8FwAGO

when 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

#13 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 08 April 2016 - 06:18 PM

That should be
print( test.safari_net.captured )


#14 Mr_Programmer

  • Members
  • 95 posts
  • LocationA CPU some where in Bolton, UK

Posted 08 April 2016 - 06:19 PM

View PostKingofGamesYami, on 08 April 2016 - 06:18 PM, said:

That should be
print( test.safari_net.captured )
tried this after i made the last comment and i still get the same error

#15 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 08 April 2016 - 06:20 PM

*facepalm*

Didn't notice you were attempting to treat the serialized (eg string) table as a table. Try using the table directly.

#16 Mr_Programmer

  • Members
  • 95 posts
  • LocationA CPU some where in Bolton, UK

Posted 08 April 2016 - 06:21 PM

View PostKingofGamesYami, on 08 April 2016 - 06:20 PM, said:

*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?

#17 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 08 April 2016 - 06:22 PM

print( sp.getStackInSlot( 1 ).safari_net.captured )


#18 Mr_Programmer

  • Members
  • 95 posts
  • LocationA CPU some where in Bolton, UK

Posted 08 April 2016 - 06:26 PM

View PostKingofGamesYami, on 08 April 2016 - 06:22 PM, said:

print( sp.getStackInSlot( 1 ).safari_net.captured )

YES, that worked! thank you!





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users