More Lua

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • I've come to the conclusion that I took the wrong approach to this by binding the LuaManager to any of the other classes. Larrik pointed out that he usually creates a global LuaManager-like object and I think I'm gonna go that route for my next iteration.

      To Larrik:
      To create namespace-like separation of interface functions, can I get away with simply registering each library with a different table name like so:

      luaL_openlib(L, "System", system, 0);
      luaL_openlib(L, "Event", event, 0);
      etc....

      I might be making a big assumption here, but PiL doesn't go into much detail as to whether the registry supports multiple library tables. Mayhap I'll post that question to the Lua list.

      Anyway, I'm hoping that I can get something clean and effective in place shortly here. Had to drop back to chapter 11 to look at events and Mr Mike's discussion on scripting....

      Rich
      "Your job is not to die for your country. Your job is to make some other poor sod die for his."
    • Tested it and it works the way I thought. You can use multiple calls to luaL_openlib() with different table names and it stacks the tables up in the registry so that you can do the namespace-like thing by simply registering a library for a given class the first time an object of that class is instanciated.
      "Your job is not to die for your country. Your job is to make some other poor sod die for his."