本文整理汇总了C++中LuaTable::endRead方法的典型用法代码示例。如果您正苦于以下问题:C++ LuaTable::endRead方法的具体用法?C++ LuaTable::endRead怎么用?C++ LuaTable::endRead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LuaTable
的用法示例。
在下文中一共展示了LuaTable::endRead方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initEnumItems
void ScriptProp::initEnumItems()
{
LuaTable enumTable(-1);
enumTable.beginRead();
for (int i = 0; i < enumTable.getLength(); i++) {
LuaTable enumItem = enumTable.get(i);
enumItem.beginRead();
if (enumItem.getLength() >= 2) {
String key = enumItem.get(0).toString();
int val = enumItem.get(1).toInt();
m_enumItems.push_back(std::make_pair(key, val));
}
enumItem.endRead();
}
enumTable.endRead();
#if 1
for (lua_pushnil(L); lua_next(L,-2); lua_pop(L, 1)) {
if (lua_type(L,-2) != LUA_TSTRING)
continue;
const char* name = lua_tostring(L, -2);
if (name[0] == '_') {
continue;
}
if (lua_isnumber(L,-1)) {
m_enumItems.push_back(std::make_pair<String,int>(name, lua_tonumber(L,-1)));
}
}
#endif
}
示例2: loadSound
void GameSound::loadSound( const Variant& v )
{
clear();
if (v.type != Variant::kTable) {
return;
}
LuaTable table = v;
table.beginRead();
String name = table.get("sound");
m_minDist = table.get("minDist");
m_maxDist = table.get("maxDist");
m_looping = table.get("looping");
m_interval = table.get("interval");
table.endRead();
if (name.empty())
return;
m_sfx << g_soundSystem->createSfx(name);
}