aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-03-27 12:30:41 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-03-27 12:30:41 -0300
commitd1f220217beadc102a8d44b8e930a92a9f54b001 (patch)
tree01e599fc7808818ad008599f192b57d32e97c995 /lauxlib.c
parent405e3a4597d6f935a7ac224ce67dce660e69c7be (diff)
downloadlua-d1f220217beadc102a8d44b8e930a92a9f54b001.tar.gz
lua-d1f220217beadc102a8d44b8e930a92a9f54b001.tar.bz2
lua-d1f220217beadc102a8d44b8e930a92a9f54b001.zip
when possible, library functions accept nil as none
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lauxlib.c b/lauxlib.c
index db7ab9b3..efa313f7 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.61 2002/03/07 18:15:10 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.62 2002/03/20 12:54:08 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*/
@@ -93,7 +93,7 @@ LUALIB_API const char *luaL_check_lstr (lua_State *L, int narg, size_t *len) {
93 93
94 94
95LUALIB_API const char *luaL_opt_lstr (lua_State *L, int narg, const char *def, size_t *len) { 95LUALIB_API const char *luaL_opt_lstr (lua_State *L, int narg, const char *def, size_t *len) {
96 if (lua_isnone(L, narg)) { 96 if (lua_isnoneornil(L, narg)) {
97 if (len) 97 if (len)
98 *len = (def ? strlen(def) : 0); 98 *len = (def ? strlen(def) : 0);
99 return def; 99 return def;
@@ -111,7 +111,7 @@ LUALIB_API lua_Number luaL_check_number (lua_State *L, int narg) {
111 111
112 112
113LUALIB_API lua_Number luaL_opt_number (lua_State *L, int narg, lua_Number def) { 113LUALIB_API lua_Number luaL_opt_number (lua_State *L, int narg, lua_Number def) {
114 if (lua_isnone(L, narg)) return def; 114 if (lua_isnoneornil(L, narg)) return def;
115 else return luaL_check_number(L, narg); 115 else return luaL_check_number(L, narg);
116} 116}
117 117