Using C# and LuaInterface, I am trying to read a nested table, but am getting a null LuaTable when I try to open the key containing the table.
The .lua file:
DB = {
["inventory"] = {
[10001] = {
["row"] = 140,
["count"] = 20,
},
[10021] = {
["row"] = 83,
["count"] = 3,
},
[10075] = {
["row"] = 927,
["count"] = 15,
},
}
}
I can successfully foreach the entries under inventory, by opening that table with:
LuaTable tbl = lua.GetTable("DB.inventory");
foreach (DictionaryEntry de in tbl)
...
What I cannot do is open an inventory item and enumerate its entries the same way. Is this because the key is a System.Double
type? This fails:
LuaTable tbl = lua.GetTable("DB.inventory.10001");
foreach (DictionaryEntry de in tbl)
with an exception, because tbl is null.
Effectively, once I enumerate the keys (inventory items), I then want to drill down into the nested table and work with those contents. As you can see, I am not able to get a reference to the nested table the way I am doing it.