diff options
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.221 2010/10/01 18:53:00 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.222 2010/10/25 19:01:37 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -330,11 +330,26 @@ LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) { | |||
330 | } | 330 | } |
331 | 331 | ||
332 | 332 | ||
333 | LUALIB_API lua_Unsigned luaL_checkunsigned (lua_State *L, int narg) { | ||
334 | int isnum; | ||
335 | lua_Unsigned d = lua_tounsignedx(L, narg, &isnum); | ||
336 | if (!isnum) | ||
337 | tag_error(L, narg, LUA_TNUMBER); | ||
338 | return d; | ||
339 | } | ||
340 | |||
341 | |||
333 | LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg, | 342 | LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg, |
334 | lua_Integer def) { | 343 | lua_Integer def) { |
335 | return luaL_opt(L, luaL_checkinteger, narg, def); | 344 | return luaL_opt(L, luaL_checkinteger, narg, def); |
336 | } | 345 | } |
337 | 346 | ||
347 | |||
348 | LUALIB_API lua_Unsigned luaL_optunsigned (lua_State *L, int narg, | ||
349 | lua_Unsigned def) { | ||
350 | return luaL_opt(L, luaL_checkunsigned, narg, def); | ||
351 | } | ||
352 | |||
338 | /* }====================================================== */ | 353 | /* }====================================================== */ |
339 | 354 | ||
340 | 355 | ||