| 24 | } |
| 25 | |
| 26 | static void PrintTable(lua_State* L, int indent) |
| 27 | { |
| 28 | if ((lua_type(L, -2) == LUA_TSTRING)) |
| 29 | { |
| 30 | PrintIndent(indent); |
| 31 | printf("%s\n", lua_tostring(L, -2)); |
| 32 | } |
| 33 | |
| 34 | lua_pushnil(L); |
| 35 | while(lua_next(L, -2) != 0) { |
| 36 | if(lua_isstring(L, -1)) |
| 37 | { |
| 38 | PrintIndent(indent); |
| 39 | printf("%s = %s\n", lua_tostring(L, -2), lua_tostring(L, -1)); |
| 40 | } |
| 41 | else if(lua_isnumber(L, -1)) |
| 42 | { |
| 43 | PrintIndent(indent); |
| 44 | printf("%s = %f\n", lua_tostring(L, -2), lua_tonumber(L, -1)); |
| 45 | } |
| 46 | else if(lua_istable(L, -1)) |
| 47 | { |
| 48 | PrintTable(L, indent+1); |
| 49 | } |
| 50 | lua_pop(L, 1); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | static bool RunString(lua_State* L, const char* script) |
| 55 | { |
no test coverage detected