File: makestr.lua

package info (click to toggle)
lua-iconv 7-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch, trixie
  • size: 132 kB
  • ctags: 33
  • sloc: ansic: 167; makefile: 26; sh: 11
file content (18 lines) | stat: -rw-r--r-- 355 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

local fp = assert(io.open(arg[1], "rb"))
local str = assert(fp:read("*a"))
fp:close()

local i
local c = 0
local ostr = "local xxxxxxxxxxx = \""
for i = 1, string.len(str) do
  ostr = ostr .. "\\" .. string.byte(string.sub(str, i, i+1))
  if string.len(ostr) > 72 then
    io.write(ostr .. "\"\n")
    ostr = ".. \""
  end
end
io.write(ostr .. "\"\n")