|
Post by podahmad on Oct 5, 2017 15:49:51 GMT
Im running same game in two instances of emulator and i need few values of bot in one instance to be used in another.... how can i do so... is there any way i can save values lets say outside script in a file and then approach them in other instance plz..help
|
|
|
Post by Mercobots on Oct 5, 2017 23:30:27 GMT
Im running same game in two instances of emulator and i need few values of bot in one instance to be used in another.... how can i do so... is there any way i can save values lets say outside script in a file and then approach them in other instance plz..help Hello i don't know what you are trying to save but i will show an example using tables using lualibtable = { "val1", "val2", "val3", }
-- convert table to string and save file = io.open(scriptPath() .. "data.luar", "w+") file:write("return " .. table_to_string(table)) io.close(file)
-- get table from file myNewTable = dofile(scriptPath() .. "data.luar")
print_r(myNewTable) Without lualibtable = { "val1", "val2", "val3", }
-- convert table to string and save file = io.open(scriptPath() .. "data.luar", "w+")
txt = "return {" for i, v in ipairs(table) do txt = txt .. "\"" .. v .. "\"," end txt = txt .. "}"
file:write(txt) io.close(file)
-- get table from file myNewTable = dofile(scriptPath() .. "data.luar")
for i, v in ipairs(myNewTable) do print(i," - ",v) end
|
|
|
Post by podahmad on Oct 6, 2017 2:09:27 GMT
Im running same game in two instances of emulator and i need few values of bot in one instance to be used in another.... how can i do so... is there any way i can save values lets say outside script in a file and then approach them in other instance plz..help Hello i don't know what you are trying to save but i will show an example using tables using lualibtable = { "val1", "val2", "val3", }
-- convert table to string and save file = io.open(scriptPath() .. "data.luar", "w+") file:write("return " .. table_to_string(table)) io.close(file)
-- get table from file myNewTable = dofile(scriptPath() .. "data.luar")
print_r(myNewTable) Without lualibtable = { "val1", "val2", "val3", }
-- convert table to string and save file = io.open(scriptPath() .. "data.luar", "w+")
txt = "return {" for i, v in ipairs(table) do txt = txt .. "\"" .. v .. "\"," end txt = txt .. "}"
file:write(txt) io.close(file)
-- get table from file myNewTable = dofile(scriptPath() .. "data.luar")
for i, v in ipairs(myNewTable) do print(i," - ",v) end
Thanksss alooot resolved my issue
|
|