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

Attempt to compare __l t on table and table

Started by PenDrag, 12 June 2014 - 07:39 PM
PenDrag #1
Posted 12 June 2014 - 09:39 PM
I am trying to get a piece of code from Direwolf20 working on my server. It should just work like his essentia refilling system in his Singleplayer Episode 74 (https://www.youtube....h?v=4bgtLYZKbFU); basically getting the name and the amount of a aspect stored in a jar and giving me the ability to fill it up.
I grabbed the code out of his world and tried to run it but got some errors. After some research in this forum i was able to solve some of them but now i am stuck. The main problem for me is that i am a noob in anything related to Computercraft.
The Code i got at the moment is:
Button
http://pastebin.com/fbwYhzfB
Aspects
http://pastebin.com/fSKUwSMZ
When i try to run Aspects i get a list of the different Aspects and the stored amount and then the error message:
"aspects:23: attempt to compare __l t on table and table"
As i said earlier i am a noob in Computercraft and to be honest i have no idea what that part of the code is actually doing.
For any sort of help i would be thankful.
GamerNebulae #2
Posted 12 June 2014 - 09:54 PM
May I lead you to my software? :3 I made a program that automatically refills the jars and is based on the same principal. The only difference is that it does not have a GUI (yet). It tries to sort the table, but I think it doesn't have any values to sort.

EDIT: My program is called "Computed Magic" and can be found in the here
Edited on 12 June 2014 - 07:57 PM
Bomb Bloke #3
Posted 12 June 2014 - 11:47 PM
Dire's script seems to be trying to compile a list of the names of essentias available, then it wants to put that list in alphabetical order. Catch is, it looks like when it tries to get the names of the essentias in the first place, instead of getting the strings it wants it's getting tables. Trying to sort tables to alphabetical order doesn't work so well…

Hence the line which leads to the error would be 37:

       asp = peripheral.call(j, "getAspects")[1]

Odds are your installed build of OpenPeripheral doesn't work the way Dire's does. Assuming GN's code doesn't fit your purposes (and if it doesn't, you might consider asking him to add what you want - you never know), a good start might be to compare version numbers.

If you're interested in tweaking Dire's script to work on your current MineCraft setup, start with a read through this tutorial, then see if you can figure out the correct peripheral call to get an essentia name.
Edited on 12 June 2014 - 09:51 PM