是否可以使用load / save json save方法更新表的一个变量?我想在另一个.lua文件中更改一个值/变量。我该如何做到这一点?
我的主要内容:
local table = {}
table.one = "no"
table.two = "no"
table.three = "no"
loadsave.saveTabe(table, "trying.json", system.DocumentsDirectory)
在check.lua中:
local value = loadsave.loadTable("trying.json, system.DocumentsDirectory)
if( 5+5 == 10)then
value.one = "yes"
--HERE I WANT TO SAVE THE VALUE TO THE SAME JSON FILE WITHOUT CHANGING THE OTHER VALUES/VARIABLES ETC.
end
答案 0 :(得分:1)
试试这个:
local value = loadsave.loadTable("trying.json", system.DocumentsDirectory)
if( 5+5 == 10) then
value.one = "yes"
loadsave.saveTabe(value, "trying.json", system.DocumentsDirectory)
end