[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Shorten long boolean IF conditions?
- From: Gregory Bonik <gregory@...>
- Date: Fri, 19 Aug 2011 12:13:34 +0400
Axel Kittenberger wrote:
> > An alternative to the solution with tables is a vararg function:
>
> With what benefit? O(n) instead of O(log(n))?
>
First, why O(log(n))? Lua tables are hash tables, not balanced trees.
Second, the table-based solution is still O(n) because it creates a new
table with n elements each time. Anyway, Lua is not about micro
optimizations.
The benefit is compactness: you don't have to introduce any additional
local variables.
-- Gregory