What function do I use to read data from a file in Lua
?
For example:
lua_folder/
.... config.json
.... main.lua
I want to open this file config.json
through Lua
.
What function do I use to read data from a file in Lua
?
For example:
lua_folder/
.... config.json
.... main.lua
I want to open this file config.json
through Lua
.
Make a function to do this like this:
function file_getdata()
local data_file_path = gre.SCRIPT_ROOT .. "/myfile.json"
local f = io.open(data_file_path)
f = io.read("*all")
f = io.close()
return f
end