   Lua: calling a script as a memberfunction of a c++ object
  Hi,I'm working on a game engine and added Lua as a scripting language. I'd like to execute game logic for every one of my objects in Lua.For example, I'll have a script to control an NPC, something like this (pseudo code)function update(mouse) {  if(maincharacter.isClose()) {    doSomething()    if(mouse.leftButton()) { saySomething()    }  }}I can bind the NPC class (together with the doSomething methods etc) and I can load the Lua script, but I don't know how I can make them execute on one of my npc objects. I'd like to do something like this in my c++ gameloop:foreach(object o in npcobject) {   doLuaUpdateScript(o,o.getScript());}I can ofcourse pass the o object to the script and write o.doSomething() instead of doSomething() in Lua but that feels like too much work :-D (programmers are lazy, no?)Does anybody have an idea whether and how this is possible?Any help is really appreciated!   