--- lam.util --- utility functions local m = {} local string = string local utf8 = require("utf8") m.luaerror = error -- signal an error -- WHERE is where in the process; DESC is a description of the error; the rest -- are "irritants" function m.error (desc, ...) m.luaerror(string.format("%s: %s", desc, table.concat({...}, " ") )) end -- remove an element from the front of TBL function m.pop (tbl) return table.remove(tbl, 1) end function m.tochars (str) local cs = {} for _, code in utf8.codes(str) do table.insert(cs, code) end return cs end function m.constantly (x) return function () return x end end -------- return m