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

Method printStack

src/ofxLua.cpp:1011–1049  ·  view source on GitHub ↗

from http://www.lua.org/pil/24.2.3.html

Source from the content-addressed store, hash-verified

1009
1010// from http://www.lua.org/pil/24.2.3.html
1011void ofxLua::printStack() {
1012 if(!isValid()) {
1013 return;
1014 }
1015
1016 std::stringstream line;
1017 line << "stack " << lua_gettop(L);
1018
1019 int top = lua_gettop(L);
1020 if(top > 0) {
1021 line << ":";
1022 }
1023 for(int i = 1; i <= top; i++) {
1024 int type = lua_type(L, i);
1025 switch(type) {
1026
1027 case LUA_TSTRING:
1028 line << " \"" << lua_tostring(L, i) << "\"";
1029 break;
1030
1031 case LUA_TBOOLEAN:
1032 line << " " << (lua_toboolean(L, i) == 1 ? "true" : "false");
1033 break;
1034
1035 case LUA_TNUMBER:
1036 line << " " << lua_tonumber(L, i);
1037 break;
1038
1039 default:
1040 line << " " << lua_typename(L, type);
1041 break;
1042
1043 }
1044 if(i != top) {
1045 line << " ";
1046 }
1047 }
1048 ofLogNotice("ofxLua") << line.str();
1049}
1050
1051// push object pointer to Lua using SWIG helper function,
1052// from http://stackoverflow.com/questions/9455552/swiglua-passing-a-c-instance-as-a-lua-function-parameter

Callers 1

runTestsMethod · 0.80

Calls 4

lua_gettopFunction · 0.85
lua_typeFunction · 0.85
lua_tobooleanFunction · 0.85
lua_typenameFunction · 0.85

Tested by

no test coverage detected