This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
gheotic's profile picture

Computer Controlled Seed Analyzer Weird method?

Started by gheotic, 20 July 2016 - 01:59 PM
gheotic #1
Posted 20 July 2016 - 03:59 PM
Recently I found out about the Computer Controlled Seed Analyzer from agricraft where you get analyze and get stats of the seeds. My problem with it is that when ever you run the method called: "getSpecimenStats()" in lua mode, it's printing out 3 lines on the screen with the 3 different stats, or thats what it looks like.

Just as a example:
Stats of a seed:
- Growth: 1
- Gain: 2
- Strength: 3

Program run in lua:

m = peripheral.wrap("back")

-- Running directly
m.getSpecimenStats()
1
2
3

-- Saving it as a variable
stats = m.getSpecimenStats()
stats -- Btw this comes out as a number variable
1

How can i save all variables when its, not really returning them in a array or dictionary, but just kinda printing 3 lines.
Lupus590 #2
Posted 20 July 2016 - 04:26 PM
Recommended method:

stats = { m.getSpecimenStats() }

stats[1] --# 1
stats[2] --# 2
stats[3] --# 3

Alternative method:

stat1, stat2, stat3 = m.getSpecimenStats()

stats1 --# 1
stats2 --# 2
stats3 --# 3
Edited on 20 July 2016 - 02:26 PM
gheotic #3
Posted 20 July 2016 - 09:17 PM
Thank you! Exactly what i was looking for :D/>