free software resistance

 the cost of computing freedom is eternal vigilance

### 1616.figlu.lua *original date:* may 2024 *originally posted:* oct 2024 1616.figlu.lua: ``` #!/usr/bin/env lua53 -- encoding: utf-8 -- figlu translator version: figlu 0.9 function figluprint(p) if type(p) == "table" then print("{"..table.concat(p, ", ").."}") else print(p) end end function figluprints(p) if type(p) == "table" then io.stdout:write("{"..table.concat(p, ", ").."}") else io.stdout:write(tostring(p)) end io.stdout:flush() end function figluexit(p) os.exit() end function figluarr(p) typep = type(p) if typep == "number" or typep == "string" then p = {p} end return p end function figluarrset(x, p, s) if type(x[p]) == "nil" then error("error: list assignment index out of range") else if type(s) == "string" or type(s) == "number" then x[p] = s end end end function figluarrget(x, p, s) if type(p[s]) == "nil" then error("error: list index out of range") else return p[s] end end function figluarrsort(p) table.sort(p) end function figluarreverse(p) -- table.reverse(p) c = 0 for k, v in pairs(p) do c = c + 1 ; end pcopy = {} ccopy = 0 for k, v in pairs(p) do ccopy = ccopy + 1 pcopy[ccopy] = p[c] c = c - 1 end c = 0 for k, v in pairs(pcopy) do c = c + 1 p[c] = pcopy[c] end end function figluminus(p, s) return p - s end function figluplus(p, s) if type(p) == "number" then return p + s end if type(p) == "string" then return p .. s end if type(p) == "table" then pc = {} for k, v in pairs(p) do table.insert(pc, v) end for k, v in pairs(s) do table.insert(pc, v) end return pc end end function figluarrshell(p) s = {} sh = io.popen(p) ps = sh:read("a*") sh:close() for k, v in string.gmatch(ps, "[^\n]+") do table.insert(s, k) end return s end function figlushell(p) os.execute(p) end function figlusplit(p, x, s) xlen = string.len(x) slen = string.len(s) xt = {} xst = x..s for each = 1, xlen do sf = string.find(xst, s, 1, true) if sf == nil then table.insert(xt, xst) break else table.insert(xt, string.sub(xst, 1, sf - 1)) xst = string.sub(xst, sf + slen) end if xst == "" then break end end return xt end function figlujoin(p, x, s) return table.concat(x, s) end function figlusleep(p, s) -- https://devhubby.com/thread/how-can-i-add-a-sleep-or-wait-to-my-lua-script t = os.time() while 1 do if os.difftime(os.time(), t) >= s then break end end end function figlufindtrue(p) if type(p) == "number" then if p == 0 then return 0 else return -1 end end if type(p) == "string" then if string.len(p) == 0 then return 0 else return -1 end end if type(p) == "table" then pc = 0 for k, v in pairs(p) do pc = 1 break end if pc == 0 then return 0 else return -1 end end end function figlucls(p) if figosname == "nt" then figlushell("cls") else io.stdout:write("" .. "[2J" .. "" .. "[1;1H") io.stdout:flush() end end figlubac = nil figprsbac = nil sub = nil function figlunone(p, figlubac) if p == nil then return figlubac end return p end function figluinstr(x, p, e) if type(p) == "table" then c = 0 s = 0 for k, v in pairs(p) do c = c + 1 if p[c] == e then s = c break end end return s end if type(p) == "string" then s = string.find(p, e, 1, true) if s == nil then s = 0 end return s end return 0 end function figlucolortext(x, f) n = "0" if f > 7 then n = "1" f = f - 8 end if f == 1 then f = 4 -- switch ansi colours for qb colours else if f == 4 then f = 1 -- 1 = blue not red, 4 = red not blue, etc. end end if f == 3 then f = 6 else if f == 6 then f = 3 end end io.stdout:write("" .. "[" .. n .. ";" .. tostring(30+f) .. "m") end function figluhighlight(x, b) n = "0" if b > 7 then b = b - 8 end if b == 1 then b = 4 -- switch ansi colours for qb colours else if b == 4 then b = 1 -- 1 = blue not red, 4 = red not blue, etc. end end if b == 3 then b = 6 else if b == 6 then b = 3 end end io.stdout:write("" .. "[" .. tostring(40+b) .. "m") end function figlustr(p) return tostring(p) end function figluval(p) n = tonumber(p) if n == math.floor(n) then n = math.floor(n) end return n end function figluint(p) n = math.floor(n) return n end figlist = 0 figlist = (type(y) == 'table') -- except NameError: pass if not figlist then y = 0 end y = 0 while 1 do figlist = 0 figlist = (type(x) == 'table') -- except NameError: pass if not figlist then x = 0 end x = 0 while 1 do figlist = 0 figlist = (type(now) == 'table') -- except NameError: pass if not figlist then now = 0 end figluhighlight(now, y) figlist = 0 figlist = (type(now) == 'table') -- except NameError: pass if not figlist then now = 0 end figlucolortext(now, x) figlist = 0 figlist = (type(now) == 'table') -- except NameError: pass if not figlist then now = 0 end now = "M" figluprints(now) figlucolortext(now, 7) figluhighlight(now, 0) if x == 15 then break end figlist = 0 figlist = (type(now) == 'table') -- except NameError: pass if not figlist then now = 0 end now = x now = figluplus(now, 1) now, x = x, now ; end figlist = 0 figlist = (type(now) == 'table') -- except NameError: pass if not figlist then now = 0 end now = "" figluprint(now) if y == 15 then break end figlist = 0 figlist = (type(now) == 'table') -- except NameError: pass if not figlist then now = 0 end now = y now = figluplus(now, 1) now, y = y, now ; end ``` license: 0-clause bsd ``` # 2024 mn # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ``` => https://freesoftwareresistance.neocities.org