本文整理汇总了C++中oolua::Script::call方法的典型用法代码示例。如果您正苦于以下问题:C++ Script::call方法的具体用法?C++ Script::call怎么用?C++ Script::call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oolua::Script
的用法示例。
在下文中一共展示了Script::call方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: globalData_addFuncToGlobalThenCall_callReturnsTrue
void globalData_addFuncToGlobalThenCall_callReturnsTrue()
{
OOLUA::set_global(*m_lua, "global_func", dummy_c_function_returns_stack_count);
bool result = m_lua->call("global_func");
CPPUNIT_ASSERT_EQUAL(true,result);
}
示例2: inOutTraitRef_luaPassesInt_functionReceivesInputedValue
void inOutTraitRef_luaPassesInt_functionReceivesInputedValue()
{
InOutParamHelper helper(m_lua);
EXPECT_CALL(helper.mock, ref(::testing::Eq(helper.input))).Times(1);
m_lua->run_chunk("return function(object, input) return object:ref(input) end");
m_lua->call(1, helper.object, helper.input);
}
示例3: inOutTraitRef_luaPassesIntCppAssignsNewValue_returnIsNewlyAssignedValue
/**[IntegerInOutParamUsage]*/
void inOutTraitRef_luaPassesIntCppAssignsNewValue_returnIsNewlyAssignedValue()
{
InOutParamHelper helper(m_lua);
EXPECT_CALL(helper.mock, ref(::testing::_)).Times(1).WillOnce(::testing::SetArgReferee<0>(helper.expected));
m_lua->run_chunk("return function(object) return object:ref(1) end");
m_lua->call(1, helper.object);
assert_top_of_stack_is_expected_value(helper.expected);
}
示例4: inOutTraitRef_luaPassesInt_functionPushesBackNumber
void inOutTraitRef_luaPassesInt_functionPushesBackNumber()
{
m_lua->register_class<IntegerFunctionInOutTraits>();
::testing::NiceMock<IntegerFunctionInOutTraitsMock> fake;
m_lua->run_chunk("return function(object) return object:ref(1) end");
m_lua->call(1, static_cast<IntegerFunctionInOutTraits*>(&fake));
CPPUNIT_ASSERT_EQUAL(LUA_TNUMBER, lua_type(*m_lua, -1));
}
示例5: outTraitPtr_luaDoesNotPassIntCppAssignsNewValue_returnIsNewlyAssignedValue
void outTraitPtr_luaDoesNotPassIntCppAssignsNewValue_returnIsNewlyAssignedValue()
{
OutParamHelper helper(m_lua);
EXPECT_CALL(helper.mock, ptr(::testing::_)).Times(1).WillOnce(::testing::SetArgumentPointee<0>(helper.expected));
m_lua->run_chunk("return function(object) return object:ptr() end");
m_lua->call(1, helper.object);
assert_top_of_stack_is_expected_value(helper.expected);
}
示例6: constructWithEnum_passedString_throwsOoluaRuntimeError
void constructWithEnum_passedString_throwsOoluaRuntimeError()
{
m_lua->register_class<Enums>();
m_lua->run_chunk("foo = function() "
"local obj = Enums:new('foo') "
"end");
CPPUNIT_ASSERT_THROW(m_lua->call("foo"),OOLUA::Runtime_error);
}
示例7: constructWithEnum_passedCoroutine_callReturnsFalse
void constructWithEnum_passedCoroutine_callReturnsFalse()
{
m_lua->register_class<Enums>();
m_lua->run_chunk("foo = function() "
"local obj = Enums:new( coroutine.create (foo)) "
"end");
CPPUNIT_ASSERT_EQUAL(false,m_lua->call("foo"));
}
示例8: constructWithEnum_passedString_callReturnsFalse
void constructWithEnum_passedString_callReturnsFalse()
{
m_lua->register_class<Enums>();
m_lua->run_chunk("foo = function() "
"local obj = Enums:new('foo') "
"end");
CPPUNIT_ASSERT_EQUAL(false,m_lua->call("foo"));
}
示例9: globalData_addIntGlobalThenReturnItFromFunction_callReturnsTrue
void globalData_addIntGlobalThenReturnItFromFunction_callReturnsTrue()
{
int input(1);
OOLUA::set_global(*m_lua, "i", input);
m_lua->run_chunk("foo = function() return i end");
bool result = m_lua->call("foo");
CPPUNIT_ASSERT_EQUAL(true,result);
}
示例10: globalData_addIntGlobalThenReturnItFromFunction_resultEqualsInput
void globalData_addIntGlobalThenReturnItFromFunction_resultEqualsInput()
{
int input(1);
OOLUA::set_global(*m_lua, "i", input);
m_lua->run_chunk("foo = function() return i end");
m_lua->call("foo");
int result;
OOLUA::pull2cpp(*m_lua,result);
CPPUNIT_ASSERT_EQUAL(input,result);
}
示例11: constructWithEnum_passedValueGreen_functionReturnsGreen
void constructWithEnum_passedValueGreen_functionReturnsGreen()
{
m_lua->register_class<Enums>();
m_lua->run_chunk("foo = function() "
"local obj = Enums:new(Enums.GREEN) "
"return obj:get_enum() "
"end");
Enums::COLOUR result(Enums::INVALID);
m_lua->call("foo");
OOLUA::pull2cpp(*m_lua,result);
CPPUNIT_ASSERT_EQUAL(Enums::GREEN,result);
}
示例12: memberFunctionSetsEnum_passedGreen_resultIsGreen
void memberFunctionSetsEnum_passedGreen_resultIsGreen()
{
m_lua->register_class<Enums>();
m_lua->run_chunk("foo = function() "
"local obj = Enums:new() "
"obj:set_enum(obj.GREEN) "
"return obj:get_enum() "
"end");
Enums::COLOUR result(Enums::INVALID);
m_lua->call("foo");
OOLUA::pull2cpp(*m_lua,result);
CPPUNIT_ASSERT_EQUAL(Enums::GREEN,result);
}
示例13: memberFunction_returnsEnum_defaultValueIsInvalid
void memberFunction_returnsEnum_defaultValueIsInvalid()
{
m_lua->register_class<Enums>();
m_lua->run_chunk("foo = function() "
"local obj = Enums:new() "
"return obj:get_enum() "
"end");
Enums::COLOUR result(Enums::GREEN);
m_lua->call("foo");
OOLUA::pull2cpp(*m_lua,result);
CPPUNIT_ASSERT_EQUAL(Enums::INVALID,result);
}