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

24 lines
588 B
Lua
Raw Normal View History

2022-10-21 16:26:16 +02:00
package.path = package.path .. ";luajson/?.lua"
local JSON = require"json"
--local enjsonf = "/home/morr/foundry/foundrydata-dev/Data/modules/wfrp4e-dotr/lang/en.json"
local careerv9 = "../compendium/wfrp4e-core.career-descriptions.json"
local careerv10 = "../compendium/v10_entries.json"
local fp = io.open(careerv9, "r")
local c9 = JSON.decode( fp:read("*a") )
fp:close()
local c10 = {}
for k, v in pairs( c9.entries) do
c10[v.id] = {
name = v.name,
text = v.description
}
end
local json10 = JSON.encode(c10)
fp = io.open(careerv10, "w+")
fp:write( json10)
fp:close()