本文整理汇总了C++中oolua::Script类的典型用法代码示例。如果您正苦于以下问题:C++ Script类的具体用法?C++ Script怎么用?C++ Script使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Script类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Init
void Init()
{
if (!s_isInitted) {
s_isInitted = true;
OOLUA::Script *S = new OOLUA::Script;
L = S->get_ptr();
luaL_openlibs(L);
lua_register(L, "PiModule", register_module);
RegisterPiLuaAPI(L);
if (luaL_dofile(L, "data/pimodule.lua")) {
Error("%s", lua_tostring(L, -1));
}
DoAllLuaModuleFiles(L);
ModsInitAll();
Pi::onPlayerChangeTarget.connect(sigc::bind(sigc::ptr_fun(&mods_event_dispatcher), "onPlayerChangeTarget"));
}
}
开发者ID:Snaar,项目名称:pioneer,代码行数:21,代码来源:PiLuaModules.cpp
示例2: scriptConstructor_checkStackSize_stackIsEmpty
void scriptConstructor_checkStackSize_stackIsEmpty()
{
OOLUA::Script s;
CPPUNIT_ASSERT_EQUAL(0, s.stack_count());
}
开发者ID:Johnny-Martin,项目名称:toys,代码行数:5,代码来源:error_check.cpp
示例3: registerClass_checkStackSize_stackIsEmpty
void registerClass_checkStackSize_stackIsEmpty()
{
OOLUA::Script s;
s.register_class<Stub1>();
CPPUNIT_ASSERT_EQUAL(0, s.stack_count());
}
开发者ID:Johnny-Martin,项目名称:toys,代码行数:6,代码来源:error_check.cpp
示例4: 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);
}
开发者ID:RyanSwann1,项目名称:ClimLib,代码行数:7,代码来源:integral_function_out_params.cpp
示例5: 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"));
}
开发者ID:coolshuiping,项目名称:oolua,代码行数:8,代码来源:enum_tests.cpp
示例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);
}
开发者ID:coolshuiping,项目名称:oolua,代码行数:8,代码来源:enum_tests.cpp
示例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"));
}
开发者ID:coolshuiping,项目名称:oolua,代码行数:8,代码来源:enum_tests.cpp
示例8: 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));
}
开发者ID:RyanSwann1,项目名称:ClimLib,代码行数:8,代码来源:integral_function_out_params.cpp
示例9: 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);
}
开发者ID:RyanSwann1,项目名称:ClimLib,代码行数:9,代码来源:integral_function_out_params.cpp
示例10: 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);
}
开发者ID:RyanSwann1,项目名称:ClimLib,代码行数:8,代码来源:integral_function_out_params.cpp
示例11: 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);
}
开发者ID:iaco79,项目名称:dotskollide,代码行数:9,代码来源:lua_globals.cpp
示例12: 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);
}
开发者ID:iaco79,项目名称:dotskollide,代码行数:11,代码来源:lua_globals.cpp
示例13: 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);
}
开发者ID:coolshuiping,项目名称:oolua,代码行数:12,代码来源:enum_tests.cpp
示例14: 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);
}
开发者ID:coolshuiping,项目名称:oolua,代码行数:13,代码来源:enum_tests.cpp
示例15: 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);
}
开发者ID:coolshuiping,项目名称:oolua,代码行数:13,代码来源:enum_tests.cpp
示例16: 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);
}
开发者ID:iaco79,项目名称:dotskollide,代码行数:7,代码来源:lua_globals.cpp
示例17:
void luaReturnsEnum0_resultIsEqualToEnum0()
{
m_lua->register_class<ClassWithEnums>();
m_lua->run_chunk("return ClassWithEnums.ENUM_0");
ClassWithEnums::ClassEnum return_value = ClassWithEnums::ENUM_1;
OOLUA::pull(*m_lua, return_value);
CPPUNIT_ASSERT_EQUAL(ClassWithEnums::ENUM_0, return_value);
}
开发者ID:Johnny-Martin,项目名称:toys,代码行数:8,代码来源:class_member_enums.cpp
注:本文中的oolua::Script类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论