Pushing nested tables
Opened this issue · 1 comments
phorcys420 commented
The example on how to push a table is great, but how would I push a table corresponding to the following ?
{name="Alex", mom={name="Mary"}}
IonutParau commented
Like this:
ls.newTable(); // Define main table
ls.newTable(); // Define subtable
ls.pushString("Mary"); // Push string Mary
ls.setField(-2, "name"); // Set subtable's name field to Mary
ls.setField(-2, "mom"); // Set main table's mom field to the subtable
ls.pushString("Alex"); // Push string Alex
ls.setField(-2, "name"); // Set main table's name field to Alex