| 605 | } |
| 606 | |
| 607 | bool 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 | |
| 635 | bool ofxLua::pushTable(const unsigned int& tableIndex) { |
| 636 | if(!isValid()) { |
no test coverage detected