summaryrefslogtreecommitdiff
path: root/lua.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-10-02 17:10:55 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-10-02 17:10:55 -0300
commitf6834f4393eaa1055c2bbde82ebb33cc58be8371 (patch)
tree3583008ef181106d0fc7e130300f12adc70a5854 /lua.h
parent78bc8e553d4190fc3b90be5b621fc0f3507586ef (diff)
downloadlua-f6834f4393eaa1055c2bbde82ebb33cc58be8371.tar.gz
lua-f6834f4393eaa1055c2bbde82ebb33cc58be8371.tar.bz2
lua-f6834f4393eaa1055c2bbde82ebb33cc58be8371.zip
new API function `lua_type' + new type lua_Type
Diffstat (limited to 'lua.h')
-rw-r--r--lua.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/lua.h b/lua.h
index fcae18cf..5257ecc9 100644
--- a/lua.h
+++ b/lua.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.h,v 1.70 2000/09/18 19:39:18 roberto Exp roberto $ 2** $Id: lua.h,v 1.71 2000/10/02 14:47:43 roberto Exp roberto $
3** Lua - An Extensible Extension Language 3** Lua - An Extensible Extension Language
4** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil 4** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
5** e-mail: lua@tecgraf.puc-rio.br 5** e-mail: lua@tecgraf.puc-rio.br
@@ -48,6 +48,13 @@ typedef struct lua_State lua_State;
48typedef int (*lua_CFunction) (lua_State *L); 48typedef int (*lua_CFunction) (lua_State *L);
49 49
50 50
51typedef enum lua_Type {
52 LUA_NOVALUE, LUA_TUSERDATA, LUA_TNUMBER, LUA_TSTRING,
53 LUA_TTABLE, LUA_TFUNCTION, LUA_TNIL
54} lua_Type;
55
56
57
51/* 58/*
52** state manipulation 59** state manipulation
53*/ 60*/
@@ -70,8 +77,10 @@ int lua_stackspace (lua_State *L);
70** access functions (stack -> C) 77** access functions (stack -> C)
71*/ 78*/
72 79
73const char *lua_type (lua_State *L, int index); 80lua_Type lua_type (lua_State *L, int index);
81const char *lua_typename (lua_State *L, lua_Type t);
74int lua_isnumber (lua_State *L, int index); 82int lua_isnumber (lua_State *L, int index);
83int lua_isstring (lua_State *L, int index);
75int lua_iscfunction (lua_State *L, int index); 84int lua_iscfunction (lua_State *L, int index);
76int lua_tag (lua_State *L, int index); 85int lua_tag (lua_State *L, int index);
77 86
@@ -171,12 +180,11 @@ void lua_concat (lua_State *L, int n);
171#define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0) 180#define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0)
172#define lua_clonetag(L,t) lua_copytagmethods(L, lua_newtag(L), (t)) 181#define lua_clonetag(L,t) lua_copytagmethods(L, lua_newtag(L), (t))
173 182
174#define lua_isfunction(L,n) (*lua_type(L,n) == 'f') 183#define lua_isfunction(L,n) (lua_type(L,n) == LUA_TFUNCTION)
175#define lua_isstring(L,n) (lua_tostring(L,n) != 0) 184#define lua_istable(L,n) (lua_type(L,n) == LUA_TTABLE)
176#define lua_istable(L,n) (*lua_type(L,n) == 't') 185#define lua_isuserdata(L,n) (lua_type(L,n) == LUA_TUSERDATA)
177#define lua_isuserdata(L,n) (*lua_type(L,n) == 'u') 186#define lua_isnil(L,n) (lua_type(L,n) == LUA_TNIL)
178#define lua_isnil(L,n) (lua_type(L,n)[2] == 'l') 187#define lua_isnull(L,n) (lua_type(L,n) == LUA_NOVALUE)
179#define lua_isnull(L,n) (*lua_type(L,n) == 'N')
180 188
181#endif 189#endif
182 190