本文整理汇总了C++中luaplus::LuaObject::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ LuaObject::GetString方法的具体用法?C++ LuaObject::GetString怎么用?C++ LuaObject::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类luaplus::LuaObject
的用法示例。
在下文中一共展示了LuaObject::GetString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadScene
bool LoadScene(const std::string &sceneName)
{
std::string fullPath;
fullPath = "Scenes/";
fullPath += sceneName;
fullPath += ".lua";
LuaPlus::LuaStateAuto state;
state = LuaPlus::LuaState::Create();
int retVal = state->DoFile(fullPath.c_str());
_ASSERT(retVal==0);
LuaPlus::LuaObject meshList = state->GetGlobals()["MeshList"];
_ASSERT(meshList.IsTable());
int numMeshes = meshList.GetCount();
for(int meshIndex=1;meshIndex <= meshList.GetCount(); meshIndex++)
{
LuaPlus::LuaObject meshObj = meshList[meshIndex];
LuaPlus::LuaObject nameObj = meshObj["Name"];
_ASSERT(nameObj.IsString());
std::string meshName = nameObj.GetString();
MeshManager::GetInstance().Load(meshName,meshObj);
Instance *inst = InstanceManager::GetInstance().CreateInstance(meshName);
inst->SetMeshName(meshName);
}
return true;
}
示例2: SetStringFromLua
// /////////////////////////////////////////////////////////////////
//
// /////////////////////////////////////////////////////////////////
bool SetStringFromLua(const LuaPlus::LuaObject &stringData, std::string &str)
{
if(!stringData.IsString()) {
return (false);
}
str.assign(stringData.GetString());
return (true);
}
示例3: RemoveListener
void LuaScriptEventManager::RemoveListener(LuaPlus::LuaObject listener, EventType type)
{
auto it = m_listenerMap.find(type);
for(auto itt = it->second.begin(); itt != it->second.end(); ++itt)
{
LuaEventListener* l = itt->get();
if(listener.GetString() == l->GetFunction().GetString())
{
itt = it->second.erase(itt);
chimera::EventListener elistener = fastdelegate::MakeDelegate(l, &LuaEventListener::EventListenerDelegate);
chimera::IEventManager::Get()->VRemoveEventListener(elistener, type);
}
}
}
示例4: throw
// /////////////////////////////////////////////////////////////////
//
// /////////////////////////////////////////////////////////////////
SliderControl::SliderControl(const LuaPlus::LuaObject &widgetScriptData, \
boost::shared_ptr<ModelViewProjStackManager> mvpStackManPtr, \
const boost::shared_ptr<GLSLShader> shaderFlatObj, \
const boost::shared_ptr<GLSLShader> shaderTexObj, \
boost::shared_ptr<FTFont> fontPtr, \
const ScreenElementId id) throw(GameException &)\
:
ControlWidget(widgetScriptData, mvpStackManPtr, shaderFlatObj, shaderTexObj, fontPtr, id)
, m_sliderPos(0.5f)
, m_sliderButPtr()
, m_sliderLineBatch()
, m_sliding(false)
, m_eventTypeId(0)
, m_lineColor(0.0f, 0.0f, 0.0f, 1.0f)
{
SetLuaSliderPosition(widgetScriptData.GetByName("SliderPosition"));
SetLuaEventId(widgetScriptData.GetByName("EventTypeId"));
std::string buttonTableName;
LuaPlus::LuaObject tableName = widgetScriptData.GetByName("ButtonTableId");
if(tableName.IsString()) {
LuaPlus::LuaObject buttonData = widgetScriptData.GetByName(tableName.GetString());
if(buttonData.IsTable()) {
m_sliderButPtr.reset(GCC_NEW ButtonControl(buttonData, mvpStackManPtr, shaderFlatObj, shaderTexObj, fontPtr, 0));
m_sliderButPtr->VSetPosition(CalculateButtonPositionFromSlider());
m_sliderButPtr->VSetText("");
m_sliderButPtr->VSetWidth(GetProjectedButtonWidth());
m_sliderButPtr->VSetHeight(GetProjectedButtonHeight());
m_sliderButPtr->VSetVisible(VIsVisible());
m_sliderButPtr->VSetEnabled(VIsEnabled());
m_sliderButPtr->SetSendEvent(false);
} else {
GF_LOG_TRACE_ERR("SliderControl::SliderControl()", "Creation of scripted slider button failed. Creating default button");
CreateDefaultButton(VGetColor(), mvpStackManPtr, fontPtr, shaderFlatObj, shaderTexObj, VIsVisible(), VIsEnabled());
}
} else {
GF_LOG_TRACE_ERR("SliderControl::SliderControl()", "Missing slider button information from script so creating default button");
CreateDefaultButton(VGetColor(), mvpStackManPtr, fontPtr, shaderFlatObj, shaderTexObj, VIsVisible(), VIsEnabled());
}
RebuildSliderLine();
}
示例5: SetLuaTextList
// /////////////////////////////////////////////////////////////////
//
// /////////////////////////////////////////////////////////////////
void ListButtonControl::SetLuaTextList(const LuaPlus::LuaObject &table)
{
bool error = true;
if(table.IsTable()) {
I64 size = table.GetTableCount();
// LUA table indices start at 1!!
for(I64 i = 1; i <= size; ++i) {
LuaPlus::LuaObject currTable = table[i];
if(currTable.IsString()) {
error = false;
m_list.push_back(std::string(currTable.GetString()));
}
}
}
#if DEBUG
if(error) {
GF_LOG_TRACE_ERR("ListButtonControl::SetLuaTextList()", "No List of text strings got from lua data");
}
#endif
}