Zuxelus / Energy-Control

GNU General Public License v3.0
22 stars 12 forks source link

getCardData() only returns first slot. #18

Closed Geird closed 3 years ago

Geird commented 3 years ago

Version: EnergyControl-1.12.2-0.1.8

What happened: After trying to multiple times, I can't seem to find a way to read any data beyond the first slot of an information panel. Based on the documentation I expected getCardData() to return "Reactor Status","100","10 000","8 500","0","5:30:18" but it just seems to return "Reactor Status".

Setup / example below.

1 (1) The program. 1 (2) Result. 1 (3) Result with title removed. 1 (5) Result with title and temperature removed. 1 (6)

Full mod list, if that's useful.

modlist.txt

Zuxelus commented 3 years ago

Function getCardData() is correct but it returns java array instead of string. Seems that CC:Tweaked cannot handle arrays. It works it in lua console but not in lua program.

Console

lua lua> x=peripheral.wrap('right') lua> x.getCardData() "0" "Off" "10 000" "8 500" "0" "0:00:00" lua>

Program local x=peripheral.wrap('right') print(x.getCardData()) Result 0 Off 10 000 8 500 0 0:00:00

Program2 local x=peripheral.wrap('right') print(type(x.getCardData())) Result string <- here it should be not string

I can add a parameter and return result in different formats (array, json, plain text, etc.)

Zuxelus commented 3 years ago

Fixed in EnergyControl-1.12.2-0.1.9.jar