lua-users home
lua-l archive

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


On 24/05/2007 13:30, I wrote:
I never looked closely at its implementation, but I recall that in Lua integration to SciTE, author avoided to put all the constants in the Lua variable space, bloating the memory use.

Of course, I meant that he avoided to bloat the memory, by avoiding to have these constants both in the C code and the Lua memory (as we don't want to rely on some separate script file).

Instead, all constants from the Scintilla component are defined as global variables, and using the __index metamethod on _G, he retrieves the constant on demand.

I suppose you can, of course, also put them in some proxy table, to avoid polluting global namespace.
This "pollution" isn't a problem in small scripts used in an application.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --