74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
return {
exec = exec;
dump = dump;
ping = ping;
chomp = chomp;
map = map;
tobool = tobool;
rndstr = function(len)
local s = ''
for i=1,len do
local ofs = math.random(0,10 + 26)
if ofs >= 10 then ofs = 0x60 + (ofs - 10)
else ofs = 0x30 + ofs end
s = s .. string.char(ofs)
|
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
return {
exec = exec;
dump = dump;
ping = ping;
chomp = chomp;
map = map;
tobool = tobool;
find = function(lst,pred)
for k,v in pairs(lst) do
local test = pred(v,k)
if test then return test end
end
return nil
end;
rndstr = function(len)
local s = ''
for i=1,len do
local ofs = math.random(0,10 + 26)
if ofs >= 10 then ofs = 0x60 + (ofs - 10)
else ofs = 0x30 + ofs end
s = s .. string.char(ofs)
|