| 262 | #else /* }{ */ |
| 263 | |
| 264 | static int tonum (lua_State *L, int arg) { |
| 265 | if (lua_type(L, arg) == LUA_TNUMBER) { /* already a number? */ |
| 266 | lua_pushvalue(L, arg); |
| 267 | return 1; |
| 268 | } |
| 269 | else { /* check whether it is a numerical string */ |
| 270 | size_t len; |
| 271 | const char *s = lua_tolstring(L, arg, &len); |
| 272 | return (s != NULL && lua_stringtonumber(L, s) == len + 1); |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | |
| 277 | static void trymt (lua_State *L, const char *mtname) { |
no test coverage detected