lua-users home
lua-l archive

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


On Mon, Jul 26, 2004 at 02:03:35AM +0200, Edgar Toernig wrote:
> My suggestion: a (module) private registry as I outlined some weeks
> ago and a new special index 'lua_registryindex(i)' which addresses
> numeric indexes in that private registry.
> 
> That way one could put all that module-global stuff (like meta tables,
> string constants, mappings, etc) once into the registry and access
> them everywhere within the module via numerical constants.
> Speed would be nearly as fast as upvalues.

I'd like to add that adding an array part to userdatas would also
provide fast typing: put a unique light userdata at some known index.
And indeed, if you could access that array using only the userdata
pointer, a userdata could serve as a module registry: just get at it
using a C global variable.

-- Jamie Webb