aboutsummaryrefslogtreecommitdiff
path: root/lua.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-05-31 16:41:52 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-05-31 16:41:52 -0300
commit0dfd04eb60a7b9d54a6348ef4d9a3fa3963682aa (patch)
tree7f2353754af0783c2713af728be68878f149b3ce /lua.h
parent1e0aaf2156bb261787606b8cf00f812d75344ff2 (diff)
downloadlua-0dfd04eb60a7b9d54a6348ef4d9a3fa3963682aa.tar.gz
lua-0dfd04eb60a7b9d54a6348ef4d9a3fa3963682aa.tar.bz2
lua-0dfd04eb60a7b9d54a6348ef4d9a3fa3963682aa.zip
`lua_strlen' upgraded to `lua_objsize' (which also works with userdata)
Diffstat (limited to 'lua.h')
-rw-r--r--lua.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/lua.h b/lua.h
index 7317bc47..48b69b5f 100644
--- a/lua.h
+++ b/lua.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.h,v 1.188 2004/03/24 13:55:46 roberto Exp roberto $ 2** $Id: lua.h,v 1.189 2004/04/30 20:13:38 roberto Exp roberto $
3** Lua - An Extensible Extension Language 3** Lua - An Extensible Extension Language
4** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil 4** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
5** http://www.lua.org mailto:info@lua.org 5** http://www.lua.org mailto:info@lua.org
@@ -145,7 +145,7 @@ LUA_API lua_Number lua_tonumber (lua_State *L, int idx);
145LUA_API lua_Integer lua_tointeger (lua_State *L, int idx); 145LUA_API lua_Integer lua_tointeger (lua_State *L, int idx);
146LUA_API int lua_toboolean (lua_State *L, int idx); 146LUA_API int lua_toboolean (lua_State *L, int idx);
147LUA_API const char *lua_tostring (lua_State *L, int idx); 147LUA_API const char *lua_tostring (lua_State *L, int idx);
148LUA_API size_t lua_strlen (lua_State *L, int idx); 148LUA_API size_t lua_objsize (lua_State *L, int idx);
149LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx); 149LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx);
150LUA_API void *lua_touserdata (lua_State *L, int idx); 150LUA_API void *lua_touserdata (lua_State *L, int idx);
151LUA_API lua_State *lua_tothread (lua_State *L, int idx); 151LUA_API lua_State *lua_tothread (lua_State *L, int idx);
@@ -244,11 +244,6 @@ LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud);
244** =============================================================== 244** ===============================================================
245*/ 245*/
246 246
247#define lua_boxpointer(L,u) \
248 (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
249
250#define lua_unboxpointer(L,i) (*(void **)(lua_touserdata(L, i)))
251
252#define lua_pop(L,n) lua_settop(L, -(n)-1) 247#define lua_pop(L,n) lua_settop(L, -(n)-1)
253 248
254#define lua_newtable(L) lua_createtable(L, 0, 0) 249#define lua_newtable(L) lua_createtable(L, 0, 0)
@@ -257,6 +252,8 @@ LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud);
257 252
258#define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0) 253#define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0)
259 254
255#define lua_strlen(L,i) lua_objsize(L,i)
256
260#define lua_isfunction(L,n) (lua_type(L,n) == LUA_TFUNCTION) 257#define lua_isfunction(L,n) (lua_type(L,n) == LUA_TFUNCTION)
261#define lua_istable(L,n) (lua_type(L,n) == LUA_TTABLE) 258#define lua_istable(L,n) (lua_type(L,n) == LUA_TTABLE)
262#define lua_islightuserdata(L,n) (lua_type(L,n) == LUA_TLIGHTUSERDATA) 259#define lua_islightuserdata(L,n) (lua_type(L,n) == LUA_TLIGHTUSERDATA)