本文整理汇总了C++中MOAILuaState::CopyToTop方法的典型用法代码示例。如果您正苦于以下问题:C++ MOAILuaState::CopyToTop方法的具体用法?C++ MOAILuaState::CopyToTop怎么用?C++ MOAILuaState::CopyToTop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MOAILuaState
的用法示例。
在下文中一共展示了MOAILuaState::CopyToTop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetValue
//----------------------------------------------------------------//
void MOAIEnvironment::SetValue ( lua_State* L ) {
MOAILuaState state ( L );
int top = state.GetTop ();
this->PushLuaClassTable ( state );
state.CopyToTop ( -3 ); // key
state.CopyToTop ( -3 ); // value
lua_settable ( state, -3 );
state.Pop ( 1 );
if ( this->PushListener ( EVENT_VALUE_CHANGED, state )) {
state.CopyToTop ( -3 ); // key
state.CopyToTop ( -3 ); // value
state.DebugCall ( 2, 0 );
}
top = state.GetTop ();
}
示例2: SetLocal
//----------------------------------------------------------------//
void MOAILuaObject::SetLocal ( MOAILuaState& state, int idx, MOAILuaLocal& ref ) {
idx = state.AbsIndex ( idx );
assert ( this->mInstanceTable );
this->mInstanceTable.PushRef ( state );
if ( ref ) {
luaL_unref ( state, -1, ref.mRef );
ref.mRef = LUA_NOREF;
}
state.CopyToTop ( idx );
ref.mRef = luaL_ref ( state, -2 );
lua_pop ( state, 1 );
}