lua-users home
lua-l archive

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



On May 25, 2009, at 7:27 PM, steve donovan wrote:

A short answer to your rhetorical question would be: the first is
primarily meant to be called, and the second is primarily intended for
indexing.

Hmmm... considering that tables are the main structure in Lua, one could argue that tables are for, well, everything one see fit to do with them...

I, for one, use FuncTable all over the place :)

E.g. using a database as an example [1]:

local DB = require( 'DB' )
local aDB = DB( 'sqlite3://localhost/test.db' )

aDB( 'drop table contact' )
aDB( 'create table contact( name varchar( 32 ), email varchar( 32 ) )' )

for aContact in aDB( 'select * from contact' ) do
    print( aContact.name, aContact.email )
end


[1] http://dev.alt.textdrive.com/browser/HTTP/DB.lua