[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: [ANN] Lua Cairo binding -updated-
- From: "Jerome Vuarand" <jerome.vuarand@...>
- Date: Fri, 25 May 2007 12:47:20 -0400
Hakki Dogusan wrote:
> - lcario creates two -namespace- tables:
> cairo - for functions
> CAIRO - for constants, enums
>
> this simplifies translating C code to Lua, ie:
> cairo_set_operator (cr, CAIRO_OPERATOR_ADD);
> becomes:
> cairo.set_operator (cr, CAIRO.OPERATOR_ADD)
Users can achieve the same result pretty easily:
local cairo = require 'lcario'
local CAIRO = cairo
and then the same code ported from C:
cairo.set_operator (cr, CAIRO.OPERATOR_ADD)
That way you don't have to pollute the global namespace with several
symbols (you could even have no global symbol and only use require
return value). You can also put all constants in a sub-table to more
clearly distinguish them:
local cairo = require 'lcario'
local CAIRO = cairo.constants