Posted 09 February 2013 - 01:48 PM
Hello,
here I want to tell you about a concept I came up with about how to send a list from lua to Java.
As you know you can't call a peripherals function with a list as a parameter.
But for my peripheral http://www.computerc...-nbt-editor-10/ I wanted to do this.
I've tried many ways but none did really work well.
The concept I ended up which was working and an ok solution was this:
I used a JSON library for lua http://regex.info/blog/lua/json and an api function turned my table into a JSON string.
Because sending this String to Java didn't work for some reason. I had to make my api saving it into a file. Next I called the peripherals function with the filename. In java I opened the file and parsed it using this JSON parser http://wiki.fasterxm...JacksonDownload into a HashMap. Back in lua I deleted the temporary file.
That's it.
So hope this helps you if you have to pass a multidimensional array to a peripheral.
here I want to tell you about a concept I came up with about how to send a list from lua to Java.
As you know you can't call a peripherals function with a list as a parameter.
But for my peripheral http://www.computerc...-nbt-editor-10/ I wanted to do this.
I've tried many ways but none did really work well.
The concept I ended up which was working and an ok solution was this:
I used a JSON library for lua http://regex.info/blog/lua/json and an api function turned my table into a JSON string.
Because sending this String to Java didn't work for some reason. I had to make my api saving it into a file. Next I called the peripherals function with the filename. In java I opened the file and parsed it using this JSON parser http://wiki.fasterxm...JacksonDownload into a HashMap. Back in lua I deleted the temporary file.
That's it.
So hope this helps you if you have to pass a multidimensional array to a peripheral.