foundryvtt-wh4-lang-fr-fr/tools/foundry_convert_tables.lua

19 lines
494 B
Lua
Raw Permalink Normal View History

2021-12-22 17:15:19 +01:00
package.path = package.path .. ";luajson/?.lua"
local JSON = require"json"
2023-02-28 21:13:36 +01:00
local path_in = "/home/morr/Téléchargements/fvtt-RollTable-you-find-yourself-in-a-tavern-what-happens-next_.json"
2021-12-22 17:15:19 +01:00
local f1 = io.open(path_in, "r")
local strjson = f1:read("*a")
f1:close()
local tabData = JSON.decode(strjson)
local results = {}
2023-02-28 21:13:36 +01:00
for idx, res in pairs(tabData.results) do
results[res.range[1].."-"..res.range[2]] = res.text
2021-12-22 17:15:19 +01:00
end
2023-02-28 21:13:36 +01:00
2021-12-22 17:15:19 +01:00
local entries = JSON.encode(results)
print()
print()
print(entries)