function t.interface(s)assert(checkInterface(s))return function(e)local n,T=t.table(e)if n==false then return false,T or""end for s,n in pairs(s)do local T,G=n(e[s])if T==false then return false,string.format("\091\105\110\116\101\114\102\097\099\101\093 \098\097\100 \118\097\108\117\101 \102\111\114 \037\115\058\n\t\037\115",tostring(s),G or"")end end return true end end
--[[**
		ensures value matches given interface definition

		@param checkTable The interface definition

		@returns A function that will return true iff the condition is passed
	**--]]
function t.interface(checkTable)
	assert(checkInterface(checkTable))
	return function(value)
		local tableSuccess, tableErrMsg = t.table(value)
		if tableSuccess == false then
			return false, tableErrMsg or ""
		end

		for key, check in pairs(checkTable) do
			local success, errMsg = check(value[key])
			if success == false then
				return false, string.format("[interface] bad value for %s:\n\t%s", tostring(key), errMsg or "")
			end
		end

		return true
	end
end
