| 679 | } |
| 680 | |
| 681 | unsigned int ofxLua::tableSize() { |
| 682 | if(!isValid()) { |
| 683 | return 0; |
| 684 | } |
| 685 | |
| 686 | if(tables.empty()) { |
| 687 | ofLogWarning("ofxLua") << "Couldn't get table size, no open tables"; |
| 688 | return 0; |
| 689 | } |
| 690 | |
| 691 | if(!lua_istable(L, LUA_STACK_TOP)) { |
| 692 | ofLogWarning("ofxLua") << "Couldn't get table size, stack var is not a table"; |
| 693 | return 0; |
| 694 | } |
| 695 | |
| 696 | return lua_rawlen(L, LUA_STACK_TOP); |
| 697 | } |
| 698 | |
| 699 | unsigned int ofxLua::tableSize(const std::string& tableName) { |
| 700 | unsigned int size = 0; |