summaryrefslogtreecommitdiff
path: root/src/lua-script/cify.lua
blob: 1c6a16b2df2f25baf0587d1a4efee6f19c6a8b96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/lua

-- "C"-ify a lua program

output_file = io.open('script.h', 'w')


output_file:write('const char *argent_script =\n')

for line in io.lines('script.lua') do
   line = string.gsub(line, '\\', '\\\\')
   line = string.gsub(line, '"', '\\"')
   output_file:write('   "'..line..'\\n"\n')
end

output_file:write(';')
output_file:close()