On Tue, May 11, 2010 at 10:59 AM, Akins, Brian <brian.ak...@turner.com> wrote: > The hook runner itself should just be in lua. Instead of scripts, you write > lua modules. If a lua module has a function with the correct names (ie, > same as hooks) it uses that: > > Ie in my module foo > > function fixups( r ) > .... > > > Would get called at fixups, etc. > > > No need for a state per file, etc. Just have one state per thread.
Ah, but what happens when there are multiple functions for same hook? We could get into magic naming and scanning of global scope, but that really turns my stomach. Speaking of lua_State instances, a problem I have not figured a nice way around yet is how to say "it's okay to use this named one attached to the scope rather than a new one" possibly with module separation. Right now spinning up one per root file is not a huge deal as the memory requirements for a lua_State are very small, but it would be nice to have the option. In practice, when I have wanted this I have just had one root and invoked different functions, and it has worked fine. Conceptually, we probably don't want different script authors stomping on each other anyway. > > > > -- > Brian Akins > >