Code Sample |
function length_of_file(filename) local fh = io.open(filename, "rb") if fh then local len = fh:seek("end") fh:close() return len end end |
Code Sample |
function hexcolor(widget) local r,g,b=Fl:get_color(widget:color(),r,g,b); local hex=string.format("#%.2X%.2X%.2X",r,g,b); return hex end |
Code Sample |
function hexcolor2(num) local r,g,b=Fl:get_color(num,r,g,b); local hex=string.format("#%.2X%.2X%.2X",r,g,b); return hex end |
Code Sample |
-- Perform a shell command and return its output function shell(c) local o, h h = assert(io.popen(c,"r")) o = h:read("*all") h:close() return o end print(shell("ls")) |