lua-users home
lua-l archive

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


2013/9/5 Tim Hill <drtimhill@gmail.com>:
>
> The difficulty is that "in" expects a callable. Anything with a "__call"
> metamethod is a valid target for "in".
>
>
> Really? I was under the impression it wanted an expression list
> (of which it uses only the first three items). In which case I don't
> see the ambiguity between __call and __in (or whatever it could
> be called).

At the syntax level (dare I call it the language lawyer level?)
you are right, of course. But what Lua does to the first of those
expressions is to try to call it.

$ lua
Lua 5.2.2  Copyright (C) 1994-2013 Lua.org, PUC-Rio
> for k in 3 do print(k) end
stdin:1: attempt to call a number value