| 26 | #include <string> |
| 27 | |
| 28 | std::string dumpLuaState(lua_State *L) { |
| 29 | std::stringstream ostr; |
| 30 | int i; |
| 31 | int top = lua_gettop(L); |
| 32 | ostr << "top=" << top << ":\n"; |
| 33 | for (i = 1; i <= top; ++i) { |
| 34 | int t = lua_type(L, i); |
| 35 | switch(t) { |
| 36 | case LUA_TSTRING: |
| 37 | ostr << " " << i << ": '" << lua_tostring(L, i) << "'\n"; |
| 38 | break; |
| 39 | case LUA_TBOOLEAN: |
| 40 | ostr << " " << i << ": " << |
| 41 | (lua_toboolean(L, i) ? "true" : "false") << "\n"; |
| 42 | break; |
| 43 | case LUA_TNUMBER: |
| 44 | ostr << " " << i << ": " << lua_tonumber(L, i) << "\n"; |
| 45 | break; |
| 46 | default: |
| 47 | ostr << " " << i << ": TYPE=" << lua_typename(L, t) << "\n"; |
| 48 | break; |
| 49 | } |
| 50 | } |
| 51 | return ostr.str(); |
| 52 | } |
| 53 | |
| 54 | static int require_resource(lua_State *L) |
| 55 | { |
nothing calls this directly
no outgoing calls
no test coverage detected