lua - Saving values of variables in files -
i'm making program uses lot of variables , changes them constantly.
how save variables file inside program?
you have use io.open(filename, mode) create file handle, use :write(linecontent) , :read("*line") write , read in order. there can "load" , "save" variables keeping track of line orders each variable use:
local f = assert(io.open("quicksave.txt", "w")) f:write(firstvariable, "\n") f:write(secondvariable, "\n") f:write(thirdvariable, "\n") f:close() local f = assert(io.open("quicksave.txt", "r")) firstvariable = f:read("*line") secondvariable = f:read("*line") thirdvariable = f:read("*line") f:close()
Comments
Post a Comment