diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-10-25 18:31:11 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-10-25 18:31:11 -0200 |
| commit | c6b64ffe65549b179bfa565e8329430857e335ee (patch) | |
| tree | 9fa644de3c5dc2e4edf42aac7249b42264f2f6e5 /lauxlib.c | |
| parent | 4590a89b32b62c75fca7ced96c282c7793b8885c (diff) | |
| download | lua-c6b64ffe65549b179bfa565e8329430857e335ee.tar.gz lua-c6b64ffe65549b179bfa565e8329430857e335ee.tar.bz2 lua-c6b64ffe65549b179bfa565e8329430857e335ee.zip | |
new type lua_Unsigned and corresponding projection/injection functions
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 | ||
