|
Post by andreos on Apr 10, 2020 13:42:05 GMT
How do I export tables as it is to a file? I want to store the information.
|
|
|
Post by andreos on Apr 11, 2020 18:41:09 GMT
It would be great if ankulua could manage json.
|
|
|
Post by AnkuLua on Apr 12, 2020 0:18:23 GMT
There are many pure lua json library. You can try https://gist.github.com/tylerneylon/59f4bcf316be525b30ab regex.info/blog/lua/json
|
|
|
Post by andreos on Apr 12, 2020 12:18:24 GMT
There are many pure lua json library. You can try https://gist.github.com/tylerneylon/59f4bcf316be525b30ab regex.info/blog/lua/jsonAll I got to do is make my code read that file (https://gist.github.com/tylerneylon/59f4bcf316be525b30ab)?
|
|
|
Post by AnkuLua on Apr 12, 2020 12:39:40 GMT
Download the Lua file. Then follow their instructions.
|
|
|
Post by andreos on Apr 12, 2020 13:26:03 GMT
|
|
|
Post by AnkuLua on Apr 13, 2020 14:38:18 GMT
Try dkjson dkolf.de/src/dkjson-lua.fsl/homeFor dkjson to work, you need to adding following in the given examples currentPath = scriptPath() package.path = package.path .. string.format(";%s/?.lua;%s/?.luac", currentPath, currentPath) type = typeOf
That is, the full example of encoding is currentPath = scriptPath() package.path = package.path .. string.format(";%s/?.lua;%s/?.luac", currentPath, currentPath) type = typeOf
local json = require ("dkjson")
local tbl = { animals = { "dog", "cat", "aardvark" }, instruments = { "violin", "trombone", "theremin" }, bugs = json.null, trees = nil }
local str = json.encode (tbl, { indent = true })
print (str)
|
|