| 107 | |
| 108 | |
| 109 | static int getfield (lua_State *L, const char *key, int d) { |
| 110 | int res; |
| 111 | lua_getfield(L, -1, key); |
| 112 | if (lua_isnumber(L, -1)) |
| 113 | res = (int)lua_tointeger(L, -1); |
| 114 | else { |
| 115 | if (d < 0) |
| 116 | return luaL_error(L, "field " LUA_QS " missing in date table", key); |
| 117 | res = d; |
| 118 | } |
| 119 | lua_pop(L, 1); |
| 120 | return res; |
| 121 | } |
| 122 | |
| 123 | |
| 124 | static int os_date (lua_State *L) { |
no test coverage detected