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!")