aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lauxlib.c4
-rw-r--r--lbaselib.c10
-rw-r--r--liolib.c6
-rw-r--r--ltests.c10
-rw-r--r--lua.h2
5 files changed, 16 insertions, 16 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 9a4b6fde..b6903013 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -81,7 +81,7 @@ LUALIB_API const char *luaL_check_lstr (lua_State *L, int narg, size_t *len) {
81 81
82 82
83LUALIB_API const char *luaL_opt_lstr (lua_State *L, int narg, const char *def, size_t *len) { 83LUALIB_API const char *luaL_opt_lstr (lua_State *L, int narg, const char *def, size_t *len) {
84 if (lua_isnull(L, narg)) { 84 if (lua_isnone(L, narg)) {
85 if (len) 85 if (len)
86 *len = (def ? strlen(def) : 0); 86 *len = (def ? strlen(def) : 0);
87 return def; 87 return def;
@@ -99,7 +99,7 @@ LUALIB_API lua_Number luaL_check_number (lua_State *L, int narg) {
99 99
100 100
101LUALIB_API lua_Number luaL_opt_number (lua_State *L, int narg, lua_Number def) { 101LUALIB_API lua_Number luaL_opt_number (lua_State *L, int narg, lua_Number def) {
102 if (lua_isnull(L, narg)) return def; 102 if (lua_isnone(L, narg)) return def;
103 else return luaL_check_number(L, narg); 103 else return luaL_check_number(L, narg);
104} 104}
105 105
diff --git a/lbaselib.c b/lbaselib.c
index 8f53a0d9..77656e12 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -137,7 +137,7 @@ static int luaB_getglobal (lua_State *L) {
137 137
138static int luaB_eventtable (lua_State *L) { 138static int luaB_eventtable (lua_State *L) {
139 luaL_check_type(L, 1, LUA_TTABLE); 139 luaL_check_type(L, 1, LUA_TTABLE);
140 if (lua_isnull(L, 2)) 140 if (lua_isnone(L, 2))
141 lua_geteventtable(L, 1); 141 lua_geteventtable(L, 1);
142 else { 142 else {
143 lua_settop(L, 2); 143 lua_settop(L, 2);
@@ -174,7 +174,7 @@ static int luaB_weakmode (lua_State *L) {
174 174
175static int luaB_globals (lua_State *L) { 175static int luaB_globals (lua_State *L) {
176 lua_getglobals(L); /* value to be returned */ 176 lua_getglobals(L); /* value to be returned */
177 if (!lua_isnull(L, 1)) { 177 if (!lua_isnone(L, 1)) {
178 luaL_check_type(L, 1, LUA_TTABLE); 178 luaL_check_type(L, 1, LUA_TTABLE);
179 lua_pushvalue(L, 1); /* new table of globals */ 179 lua_pushvalue(L, 1); /* new table of globals */
180 lua_setglobals(L); 180 lua_setglobals(L);
@@ -213,7 +213,7 @@ static int luaB_collectgarbage (lua_State *L) {
213 213
214static int luaB_type (lua_State *L) { 214static int luaB_type (lua_State *L) {
215 luaL_check_any(L, 1); 215 luaL_check_any(L, 1);
216 if (lua_isnull(L, 2)) 216 if (lua_isnone(L, 2))
217 lua_pushstring(L, lua_typename(L, lua_type(L, 1))); 217 lua_pushstring(L, lua_typename(L, lua_type(L, 1)));
218 else { 218 else {
219 lua_pushboolean(L, 219 lua_pushboolean(L,
@@ -362,7 +362,7 @@ static int luaB_call (lua_State *L) {
362 int err = 0; /* index of old error method */ 362 int err = 0; /* index of old error method */
363 int status; 363 int status;
364 int n; 364 int n;
365 if (!lua_isnull(L, 4)) { /* set new error method */ 365 if (!lua_isnone(L, 4)) { /* set new error method */
366 lua_getglobal(L, LUA_ERRORMESSAGE); 366 lua_getglobal(L, LUA_ERRORMESSAGE);
367 err = lua_gettop(L); /* get index */ 367 err = lua_gettop(L); /* get index */
368 lua_pushvalue(L, 4); 368 lua_pushvalue(L, 4);
@@ -618,7 +618,7 @@ static int luaB_sort (lua_State *L) {
618 int n; 618 int n;
619 luaL_check_type(L, 1, LUA_TTABLE); 619 luaL_check_type(L, 1, LUA_TTABLE);
620 n = lua_getn(L, 1); 620 n = lua_getn(L, 1);
621 if (!lua_isnull(L, 2)) /* is there a 2nd argument? */ 621 if (!lua_isnone(L, 2)) /* is there a 2nd argument? */
622 luaL_check_type(L, 2, LUA_TFUNCTION); 622 luaL_check_type(L, 2, LUA_TFUNCTION);
623 lua_settop(L, 2); /* make sure there is two arguments */ 623 lua_settop(L, 2); /* make sure there is two arguments */
624 auxsort(L, 1, n); 624 auxsort(L, 1, n);
diff --git a/liolib.c b/liolib.c
index 6d584572..cc572a55 100644
--- a/liolib.c
+++ b/liolib.c
@@ -177,7 +177,7 @@ static int io_tmpfile (lua_State *L) {
177 177
178static int io_fromto (lua_State *L, int inout, const char *mode) { 178static int io_fromto (lua_State *L, int inout, const char *mode) {
179 FILE *current; 179 FILE *current;
180 if (lua_isnull(L, 1)) { 180 if (lua_isnone(L, 1)) {
181 getopthandle(L, inout); 181 getopthandle(L, inout);
182 resetfile(L, inout); 182 resetfile(L, inout);
183 return io_close(L); 183 return io_close(L);
@@ -405,7 +405,7 @@ static int io_seek (lua_State *L) {
405 405
406 406
407static int io_flush (lua_State *L) { 407static int io_flush (lua_State *L) {
408 FILE *f = (lua_isnull(L, 1)) ? (FILE *)(NULL) : 408 FILE *f = (lua_isnone(L, 1)) ? (FILE *)(NULL) :
409 (FILE *)(luaL_check_userdata(L, 1, FILEHANDLE)); 409 (FILE *)(luaL_check_userdata(L, 1, FILEHANDLE));
410 return pushresult(L, fflush(f) == 0); 410 return pushresult(L, fflush(f) == 0);
411} 411}
@@ -525,7 +525,7 @@ static int io_date (lua_State *L) {
525 525
526 526
527static int io_time (lua_State *L) { 527static int io_time (lua_State *L) {
528 if (lua_isnull(L, 1)) /* called without args? */ 528 if (lua_isnone(L, 1)) /* called without args? */
529 lua_pushnumber(L, time(NULL)); /* return current time */ 529 lua_pushnumber(L, time(NULL)); /* return current time */
530 else { 530 else {
531 time_t t; 531 time_t t;
diff --git a/ltests.c b/ltests.c
index feeeaee9..33dc272a 100644
--- a/ltests.c
+++ b/ltests.c
@@ -225,7 +225,7 @@ static int get_limits (lua_State *L) {
225 225
226 226
227static int mem_query (lua_State *L) { 227static int mem_query (lua_State *L) {
228 if (lua_isnull(L, 1)) { 228 if (lua_isnone(L, 1)) {
229 lua_pushnumber(L, memdebug_total); 229 lua_pushnumber(L, memdebug_total);
230 lua_pushnumber(L, memdebug_numblocks); 230 lua_pushnumber(L, memdebug_numblocks);
231 lua_pushnumber(L, memdebug_maxmem); 231 lua_pushnumber(L, memdebug_maxmem);
@@ -239,7 +239,7 @@ static int mem_query (lua_State *L) {
239 239
240 240
241static int hash_query (lua_State *L) { 241static int hash_query (lua_State *L) {
242 if (lua_isnull(L, 2)) { 242 if (lua_isnone(L, 2)) {
243 luaL_arg_check(L, lua_type(L, 1) == LUA_TSTRING, 1, "string expected"); 243 luaL_arg_check(L, lua_type(L, 1) == LUA_TSTRING, 1, "string expected");
244 lua_pushnumber(L, tsvalue(luaA_index(L, 1))->tsv.hash); 244 lua_pushnumber(L, tsvalue(luaA_index(L, 1))->tsv.hash);
245 } 245 }
@@ -335,7 +335,7 @@ static int unref (lua_State *L) {
335 335
336static int eventtable (lua_State *L) { 336static int eventtable (lua_State *L) {
337 luaL_check_any(L, 1); 337 luaL_check_any(L, 1);
338 if (lua_isnull(L, 2)) 338 if (lua_isnone(L, 2))
339 lua_geteventtable(L, 1); 339 lua_geteventtable(L, 1);
340 else { 340 else {
341 lua_settop(L, 2); 341 lua_settop(L, 2);
@@ -429,7 +429,7 @@ static int doremote (lua_State *L) {
429 } 429 }
430 else { 430 else {
431 int i = 0; 431 int i = 0;
432 while (!lua_isnull(L1, ++i)) 432 while (!lua_isnone(L1, ++i))
433 lua_pushstring(L, lua_tostring(L1, i)); 433 lua_pushstring(L, lua_tostring(L1, i));
434 lua_pop(L1, i-1); 434 lua_pop(L1, i-1);
435 return i-1; 435 return i-1;
@@ -518,7 +518,7 @@ static int testC (lua_State *L) {
518 lua_pushnumber(L, lua_isnil(L, getnum)); 518 lua_pushnumber(L, lua_isnil(L, getnum));
519 } 519 }
520 else if EQ("isnull") { 520 else if EQ("isnull") {
521 lua_pushnumber(L, lua_isnull(L, getnum)); 521 lua_pushnumber(L, lua_isnone(L, getnum));
522 } 522 }
523 else if EQ("tonumber") { 523 else if EQ("tonumber") {
524 lua_pushnumber(L, lua_tonumber(L, getnum)); 524 lua_pushnumber(L, lua_tonumber(L, getnum));
diff --git a/lua.h b/lua.h
index 61d9e973..a008a7a0 100644
--- a/lua.h
+++ b/lua.h
@@ -227,7 +227,7 @@ LUA_API int lua_getweakmode (lua_State *L, int index);
227#define lua_isuserdata(L,n) (lua_type(L,n) == LUA_TUSERDATA) 227#define lua_isuserdata(L,n) (lua_type(L,n) == LUA_TUSERDATA)
228#define lua_isnil(L,n) (lua_type(L,n) == LUA_TNIL) 228#define lua_isnil(L,n) (lua_type(L,n) == LUA_TNIL)
229#define lua_isboolean(L,n) (lua_type(L,n) == LUA_TBOOLEAN) 229#define lua_isboolean(L,n) (lua_type(L,n) == LUA_TBOOLEAN)
230#define lua_isnull(L,n) (lua_type(L,n) == LUA_TNONE) 230#define lua_isnone(L,n) (lua_type(L,n) == LUA_TNONE)
231 231
232#define lua_pushliteral(L, s) lua_pushlstring(L, "" s, \ 232#define lua_pushliteral(L, s) lua_pushlstring(L, "" s, \
233 (sizeof(s)/sizeof(char))-1) 233 (sizeof(s)/sizeof(char))-1)