diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-05-16 10:58:21 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-11-01 09:52:45 (GMT) |
commit | 3c1d7bb1c521e824dfa46903fd4014722d0f5a29 (patch) | |
tree | b9d8ab1f95aa608cbef817550ccc4bd42534dcd6 /libs/lua/test/xd.lua | |
parent | 2223c879bf41d2b4f40fa43db478ba1bce8523de (diff) | |
download | fluxbox_paul-3c1d7bb1c521e824dfa46903fd4014722d0f5a29.zip fluxbox_paul-3c1d7bb1c521e824dfa46903fd4014722d0f5a29.tar.bz2 |
Add lua as an internal library in libs/lua
Diffstat (limited to 'libs/lua/test/xd.lua')
-rw-r--r-- | libs/lua/test/xd.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/lua/test/xd.lua b/libs/lua/test/xd.lua new file mode 100644 index 0000000..ebc3eff --- /dev/null +++ b/libs/lua/test/xd.lua | |||
@@ -0,0 +1,14 @@ | |||
1 | -- hex dump | ||
2 | -- usage: lua xd.lua < file | ||
3 | |||
4 | local offset=0 | ||
5 | while true do | ||
6 | local s=io.read(16) | ||
7 | if s==nil then return end | ||
8 | io.write(string.format("%08X ",offset)) | ||
9 | string.gsub(s,"(.)", | ||
10 | function (c) io.write(string.format("%02X ",string.byte(c))) end) | ||
11 | io.write(string.rep(" ",3*(16-string.len(s)))) | ||
12 | io.write(" ",string.gsub(s,"%c","."),"\n") | ||
13 | offset=offset+16 | ||
14 | end | ||