I get this error "too many captures" on this line:
gM.webServiceUserId, mute, volume, gM.roundCount,gM.puntajeTotal,gM.tiempo,gM.facebookLogro,gM.twitterLogro,gM.a,gM.b,gM.c,gM.d,gM.e,gM.f,gM.g,gM.h,gM.i,gM.j,gM.k,gM.l,gM.m,gM.n,gM.o,gM.p,gM.q,gM.r,gM.s,gM.t,gM.u,gM.v,gM.w,gM.x,gM.y,gM.z = string.match(saveData, "(%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+)")
its a total of 34 data on my file. what I want to do here is assign each line to the variables example:
on file ( 1,2,3,4,5)
var1=1
var2=2
var3= 3
var4= 4
var5 = 5
I got this error when I added more variables please help me find a solution
the things I wanna do here is to save 34 variables into 1 file(system.DocumentsDirectory), when the game shutdowns, and then load them again when the game launch... it works but with a few variables but when I added more I get that error....
lua code corona sdk
One thing you could do is store your data into the file differently, using a key=value format:
local saveData = ''
for k, v in gM do
saveData = (saveData..k..'='..v..',')
end
-- Your code to write the saveData into the save file
Afterwards, you would be able to load / retrieve from the file like that:
for k, v in string.gmatch(s, "(%w+)=(%d+)") do
gM[k] = v
end
Note that this would only work for the gM variables :) You would need to store mute and volume in gM too (gM.mute, gM.volume).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With