lua-users home
lua-l archive

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


> > function call.  The LuaState distribution does this by 
> introducing the
> > -> (like the colon but for method tables) and the :: (like 
> a regular .
> > Period table lookup).
> 
> That seems strange.  Why is the double colon not the 
> extension of the colon operator and the -> a version of the . 
> (like in C)?

Just in case I was unclear:

table::function() passes no implicit self and would be the same as:

methods(table).function()

table->function() passes an implicit self and would be the same as:

methods(table):function()

That's all there is to it.  The use of the :: and -> operator is just to
mask the methods(table) lookup.

I am unsure exactly of what you were asking, but the :: operator is like
the C++ :: operator and the -> operator is like the C++ . or ->
operators.

Josh