1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-01 15:35:47 +00:00
Aquaria/tools/stringbank_gen.lua
fgenesis 8f565c6171 Include stringbank.txt into binary in case stringbank.txt is out of date
This makes sure engine-internal strings are always present.
2018-01-02 20:59:38 +01:00

20 lines
577 B
Lua

local out = { "// Generated by tools/stringbank_gen.lua" }
for line in io.lines"../files/data/stringbank.txt" do
if #line > 0 then
local id, str = line:match"^%s*(%d+)%s*(.*)$"
if not id then
error("Parse error: " .. line)
end
str = str:gsub("|", "\\n")
str = "BANKSTRING(" .. id .. ", \"" .. str .. "\")"
print(str)
table.insert(out, str)
end
end
table.insert(out, "\n")
local fh = assert(io.open("../Aquaria/StringBank_gen.h", "w"))
fh:write(table.concat(out, "\n"))
fh:close()
print("All done!")