aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-12-05 18:15:18 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-12-05 18:15:18 -0200
commit592a309177edc52847b1196969ad6d49ba21f4fb (patch)
tree06add977885c012ee22cc4f105785c435b6af353 /lauxlib.c
parent413fc7334bf8ceaea71417d73edef15c99d3a793 (diff)
downloadlua-592a309177edc52847b1196969ad6d49ba21f4fb.tar.gz
lua-592a309177edc52847b1196969ad6d49ba21f4fb.tar.bz2
lua-592a309177edc52847b1196969ad6d49ba21f4fb.zip
tag system replaced by event tables
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 1189af50..849daa33 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.53 2001/10/31 19:40:14 roberto Exp $ 2** $Id: lauxlib.c,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $
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*/
@@ -43,7 +43,8 @@ LUALIB_API void luaL_argerror (lua_State *L, int narg, const char *extramsg) {
43 43
44LUALIB_API void luaL_typerror (lua_State *L, int narg, const char *tname) { 44LUALIB_API void luaL_typerror (lua_State *L, int narg, const char *tname) {
45 char buff[80]; 45 char buff[80];
46 sprintf(buff, "%.25s expected, got %.25s", tname, lua_type(L,narg)); 46 sprintf(buff, "%.25s expected, got %.25s", tname,
47 lua_typename(L, lua_type(L,narg)));
47 luaL_argerror(L, narg, buff); 48 luaL_argerror(L, narg, buff);
48} 49}
49 50
@@ -59,26 +60,18 @@ LUALIB_API void luaL_check_stack (lua_State *L, int space, const char *mes) {
59} 60}
60 61
61 62
62LUALIB_API void luaL_check_rawtype(lua_State *L, int narg, int t) { 63LUALIB_API void luaL_check_type(lua_State *L, int narg, int t) {
63 if (lua_rawtag(L, narg) != t) 64 if (lua_type(L, narg) != t)
64 tag_error(L, narg, t); 65 tag_error(L, narg, t);
65} 66}
66 67
67 68
68LUALIB_API void luaL_check_any (lua_State *L, int narg) { 69LUALIB_API void luaL_check_any (lua_State *L, int narg) {
69 if (lua_rawtag(L, narg) == LUA_TNONE) 70 if (lua_type(L, narg) == LUA_TNONE)
70 luaL_argerror(L, narg, "value expected"); 71 luaL_argerror(L, narg, "value expected");
71} 72}
72 73
73 74
74LUALIB_API void *luaL_check_userdata (lua_State *L, int narg,
75 const char *name) {
76 if (strcmp(lua_type(L, narg), name) != 0)
77 luaL_typerror(L, narg, name);
78 return lua_touserdata(L, narg);
79}
80
81
82LUALIB_API const char *luaL_check_lstr (lua_State *L, int narg, size_t *len) { 75LUALIB_API const char *luaL_check_lstr (lua_State *L, int narg, size_t *len) {
83 const char *s = lua_tostring(L, narg); 76 const char *s = lua_tostring(L, narg);
84 if (!s) tag_error(L, narg, LUA_TSTRING); 77 if (!s) tag_error(L, narg, LUA_TSTRING);