lua-users home
lua-l archive

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


How do I get the function value from the stack?

-----------------------------------
Sample Lua code:

function onTimer()
	doStuff();
end

function onInit()
	-- This is a C function
	setTimer( 5.0, onTimer );
end

----------------------------------
C code:

static int setTimer(lua_State *L) 
{
	if ( lua_isnumber( L, 1 ) )
		g_waitTime = lua_tonumber( L, 1 );

	// lua_typename( L, lua_type( L, 2 ) )
	// returns "function" which is what I want :)

	g_functionName = // How do I get this parameter?

	return 0;
}

Please help me out!

/Peter