lua-users home
lua-l archive

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


> I have a pretty strange question about Lua.
> We use tables to emulate classes in the Lua 5.0 language.
> Now is there a way to "intercept" method calls this way... so 
> that whenever i invoke a method on a table a C Function is 
> called ( similar like this )
> 
> LUA:
> myObject:doSomething()
> 
> C++
> void OnMethodCall( const char * methodname,lua_State * s ) {
> 
> }

Yes.  See the LuaInterface for .NET code
(http://www.inf.puc-rio.br/~mascarenhas/luainterface/) as an example of how.
Also, the Lua COM code does a similar type of thing.

Josh