MCPcopy Create free account
hub / github.com/danomatika/ofxLua / pushTable

Method pushTable

src/ofxLua.cpp:607–633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605}
606
607bool ofxLua::pushTable(const std::string& tableName) {
608 if(!isValid()) {
609 return false;
610 }
611
612 // global table
613 if(tables.empty()) {
614 lua_getglobal(L, tableName.c_str());
615 if(!lua_istable(L, LUA_STACK_TOP)) {
616 ofLogWarning("ofxLua") << "Couldn't push global table \"" << tableName << "\"";
617 return false;
618 }
619 }
620
621 // table in another table
622 else {
623 lua_pushstring(L, tableName.c_str());
624 lua_gettable(L, -2);
625 if(!lua_istable(L, LUA_STACK_TOP)) {
626 ofLogWarning("ofxLua") << "Couldn't push table \"" << tableName << "\"";
627 return false;
628 }
629 }
630
631 tables.push_back({LUA_TSTRING, tableName, 0});
632 return true;
633}
634
635bool ofxLua::pushTable(const unsigned int& tableIndex) {
636 if(!isValid()) {

Callers 1

runTestsMethod · 0.80

Calls 4

lua_getglobalFunction · 0.85
lua_pushstringFunction · 0.85
lua_gettableFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected