[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: require() parse error in 5.3.4/5.4.0-work2?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 27 Jun 2018 14:21:29 -0300
If you want to be strict, use code like this:
function check(t,...)
local a=table.pack(...)
assert(#t==a.n, #t.." arguments expected")
for i=1,a.n do
assert(t[i]==a[i],"arg #"..i.." expected to be "..t[i])
end
end
local function strict(f,t)
return function (...)
check(t,...)
return f(...)
end
end
require=strict(require,{ "string"})
require(23)
require("a","oops")