lua-users home
lua-l archive

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


On Tue, 4 Jan 2011, Leo Razoumov wrote:
>
> And how exactly I am supposed to do this job? E.g., how can I test
> that an array  t coming my way from someone else's library has no
> holes?

Two options:

1: Don't bother. It's the caller's responsibility to obey your API
requirements.

2: Give your tables a metatable that keeps track of the invariants you
require, if they don't match the ones provided by Lua.

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
HUMBER THAMES DOVER WIGHT PORTLAND: NORTH BACKING WEST OR NORTHWEST, 5 TO 7,
DECREASING 4 OR 5, OCCASIONALLY 6 LATER IN HUMBER AND THAMES. MODERATE OR
ROUGH. RAIN THEN FAIR. GOOD.