| 123 | |
| 124 | |
| 125 | static int getfield (lua_State *L, const char *key, int d) { |
| 126 | int res; |
| 127 | lua_getfield(L, -1, key); |
| 128 | if (lua_isnumber(L, -1)) |
| 129 | res = (int)lua_tointeger(L, -1); |
| 130 | else { |
| 131 | if (d < 0) |
| 132 | return luaL_error(L, "field " LUA_QS " missing in date table", key); |
| 133 | res = d; |
| 134 | } |
| 135 | lua_pop(L, 1); |
| 136 | return res; |
| 137 | } |
| 138 | |
| 139 | |
| 140 | static int os_date (lua_State *L) { |
no test coverage detected