lua-users home
lua-l archive

Re: require() parse error in 5.3.4/5.4.0-work2?

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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")

AltStyle によって変換されたページ (->オリジナル) /