[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Argument checking in Lua?
- From: Doug Rogers <rogers@...>
- Date: Wed, 01 Feb 2006 15:45:51 -0500
Chris Marrin wrote:
> Wow, that seems like a lot of work. Has anyone done a library to make
> any of this simpler?
Well, the meat of it is only a handful of lines of Lua. If you can live
without the flexibility of establishing your own types (a different
thread recently discussed), then it could be as simple as:
function types(args)
local tt = {}
table.foreachi(args, function(_,v)
table.insert(tt, ',' .. type(v))
end)
return string.sub(table.concat(tt), 2)
end
--
--__-__-____------_--_-_-_-___-___-____-_--_-___--____
Doug Rogers - ICI - V:703.893.2007x220 www.innocon.com
-_-_--_------____-_-_-___-_--___-_-___-_-_---_--_-__-_