Hello dear defolders I have this code
for i = 1, #personnel do
print(i)
for k, v in pairs(personnel[i]) do
print(k, v)
defsave.set("personnel_1", ""..personnel[i][k] , personnel[i][k].v )
end
defsave.save("personnel_1", true)
where I want to save all table of data of lua to a save.
the lua is like this
local M ={
{ text = "Tom Smith", wage = "3000$", photo = "profile1", pos = "editor", lvl = "Level 2", time = 1 },
{ text = "Bruce Johnson", wage = "1500$", photo = "profile2", pos = "reporter", lvl = "Level 1", time = 3 },
{ text = "Mary Miller", wage = "1800$"......},
{.......
when I run the code I have this error
DEBUG:SCRIPT: 1
DEBUG:SCRIPT: lvl Level 2
DEBUG:SCRIPT: pos editor
DEBUG:SCRIPT: photo profile1
DEBUG:SCRIPT: time 3
ERROR:SCRIPT: /main/save.gui_script:125: attempt to index a number value
stack traceback:
/main/save.gui_script:125: in function </main/save.gui_script:104>
so defsave cannot do it because one value is number? cannot have in data number and strings?
or I have sth wrong in my code?
Thanks a lot for the help