File: escaped.lua

package info (click to toggle)
freepops 0.2.7-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 5,464 kB
  • ctags: 2,677
  • sloc: ansic: 16,571; sh: 1,781; makefile: 1,127; cpp: 350
file content (21 lines) | stat: -rw-r--r-- 426 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/lua

assert(os.setlocale("en_US"),"unable to set locale")

res = {}
for i=0,255 do
	local _,_,c = string.find(string.char(i),"(%C)")
	if c ~= nil then
		table.insert(res,string.format("%s = %03d",c,string.byte(c)))
	end
end

q = math.ceil(#res/4)
fake = "       "
for i=1,q-1 do
	print(string.format("\t%s\t\t%s\t\t%s\t\t%s",
		res[i] or fake,
		res[i+q] or fake,
		res[i+q+q] or fake,
		res[i+q+q+q] or fake))
end