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

25 lines
652 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"
2021-12-28 10:45:38 +01:00
local path_in = "../tables/euphemism.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 = {}
for idx, row in pairs(tabData.rows) do
2021-12-28 10:47:03 +01:00
if row.range.Noun[1] then
local min = row.range.Noun[1]
local max = row.range.Noun[2]
2021-12-22 22:08:39 +01:00
local field = tostring(min).."-"..tostring(max)
2021-12-24 15:06:39 +01:00
--results[field] = "<b>"..row.name.."</b>:"..row.description
2021-12-28 10:47:03 +01:00
results[field] = row.Noun.description
2021-12-22 22:08:39 +01:00
print(field, row.name)
2021-12-28 10:41:35 +01:00
end
2021-12-22 17:15:19 +01:00
end
local entries = JSON.encode(results)
print()
print()
print(entries)