lua-users home
lua-l archive

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


> On the other hand, if the Lua binding uses luaL_reg structs to define the
> binding names, then it's pretty simple to traverse it and register the
> functions as globals with the correct prefix attached. In this way, you
> get both options.

Perhaps some standard means for a library to 'globalise' itself would be
useful for people who like such things?

Kind of along the lines of the compat stuff for Lua4 code, but per-module.
So by default when loading a module, you get it in a namespace, but by using
the module 'globalise' call, you can expose it. Something like:

    cheia.load("SDL")
    SDL:Gobalise()

By default this wopuld simply place any given module into global functions
with it's module prefix (SDL.LoadBMP gets put into SDL_LoadBMP() etc).
However a Module could override this to allow for other behaviour, or adding
some other 'compatibility' stuff (as the compat.lua layer does)

note, I don't think it should actually be called 'globalise' :)


Love, Light and Peace,
- Peter Loveday
Director of Development, eyeon Software