1

I'm trying to write a table with LUAJ and I want to export it to a file. Is it possible?

final LuaTable innerTable = new LuaTable();
innerTable.set("key", "value");

final LuaTable parentTable = new LuaTable();
parentTable.set("parentKey", innerTable);

The output file should contain something like this:

table = {
    ["parentKey"] = {
         key = "value"
    }
}

I don't find any option to export the content of my parentTable to a file.

Thanks.

maqjav
  • 2,310
  • 3
  • 23
  • 35
  • I had added quotes to the "key" word by mistake. Anyway my question is about how to print the output of that table. If the output is not the expected then I will fix it once I get the result :). Thanks. – maqjav Dec 23 '20 at 16:43
  • There should be no Java tag. It shouldn't matter what language LUA is written in. – NomadMaker Dec 23 '20 at 17:26
  • You are right, changed. – maqjav Dec 23 '20 at 18:09
  • So your question is: how to generate object lua code based on object created in luaj? – Leszek Mazur Dec 23 '20 at 18:17
  • 1
    You should check answers in [this question](https://stackoverflow.com/questions/9168058/how-to-dump-a-table-to-console) – Leszek Mazur Dec 23 '20 at 18:22
  • Thanks Leszek, thats what I was looking for, although I thought there would be something more straight forward. I think I will dump it directly with Java and forget about Luaj. – maqjav Dec 24 '20 at 21:30

0 Answers0