[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How do I pass a pointer to a lua function into C++?
- From: Colm Sloan <colmsloan@...>
- Date: Fri, 7 Aug 2009 12:22:59 +0100
I tried what you said and got an error:
No matching overload found, candidates:
void __init(luabind::argument const&,custom [float],int,lua_State*)
I removed the lua_State* from my constructors and binding etc. and
stopped receiving the error. It's like it's just not recognising the
function() argument as a lua_State*.
Here's the lua code:
myTimer = Timer( 2, 10, function() Msg('in timer constructor') end )
Here's the constructor call:
Timer::Timer( float delay, int repetitions, lua_State* L ) :
m_fDelay( delay ), m_iRepetitions( repetitions ), m_fInitialTime(
gpGlobals->curtime )
{
luaL_checktype( L, -1, LUA_TFUNCTION );
m_luaFunction = luaL_ref( L, LUA_REGISTRYINDEX );
}
Any ideas why it's generating that error? Thanks.