如果我想检查一个变量或从我在corona SDK中创建的表中获取一个值,该怎么办?我知道你在C ++中使用索引号,但是当我尝试它时它不起作用。
在main.lua中:
local table = {}
table.first = "string"
table.second = 25
table.third = "I want to get this one"
loadsave.saveTable(table,"table.json", system.DocumentsDirectory)
in another.lua
local getTable = loadsave.loadTable("table.json", system.DocumentsDirectory)
--here I would like to get the third value from the table and print it
答案 0 :(得分:1)
试试这个:
local table = {}
table.third = "I want to get this one"
print( table.third )
===============================
output: "I want to get this one"