about summary refs log tree commit diff stats
path: root/util.lua
blob: 7040e336ce64fb40f2e86d862c02b161289ef60f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--- lam.util --- utility functions

local m = {}
local string = string

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, ...)
	local irritants = {}
	for _, i in ipairs({...}) do
		table.insert(irritants, tostring(i))
	end
	m.luaerror(string.format("%s: %s", desc, table.concat(irritants, ", ")
	))
end

-- remove an element from the front of TBL
function m.pop (tbl)
	return table.remove(tbl, 1)
end

--------
return m