lua-users home
lua-l archive

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


>> Quoth SoniEx2:
>> What is the actual, root, core, user-facing problem you're trying to
>> solve?
>>
> I have 2 functions, one for heavy tables, another for light tables, I wanna
> be able to merge both together for (memory) efficiency.

If your use-case values memory efficiency more than CPU efficiency,
then why not just count the keys using pairs() and an increment
variable, and get the count that way? You could put this into its own
function and even store that as `table.nkeys` if you'd like.