History

Lua 5.2.0-rc1

Lua Team committed 14 years ago

Commit d74d0e51 parent 8203bab51 files · +1861 −1136Browse files

Showing the changes to src/lua.h (1 of 51 files). Show all

Unified · Split

src/lua.h+7−10
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lua.h,v 1.278 2011/07/02 16:00:15 roberto Exp $2** $Id: lua.h,v 1.281 2011/10/24 16:53:05 roberto Exp $
3** Lua - A Scripting Language3** Lua - A Scripting Language
4** Lua.org, PUC-Rio, Brazil (http://www.lua.org)4** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
5** See Copyright Notice at the end of this file5** See Copyright Notice at the end of this file
@@ -19,7 +19,7 @@ · 13 unmodified lines
19#define LUA_VERSION_MAJOR "5"19#define LUA_VERSION_MAJOR "5"
20#define LUA_VERSION_MINOR "2"20#define LUA_VERSION_MINOR "2"
21#define LUA_VERSION_NUM 50221#define LUA_VERSION_NUM 502
22#define LUA_VERSION_RELEASE "0" " (beta)"22#define LUA_VERSION_RELEASE "0"
23 23
24#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR24#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
25#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE25#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
@@ -215,10 +215,12 @@ LUA_API int (lua_pushthread) (lua_State *L); · 189 unmodified lines
215/*215/*
216** get functions (Lua -> stack)216** get functions (Lua -> stack)
217*/217*/
218LUA_API void (lua_getglobal) (lua_State *L, const char *var);
218LUA_API void (lua_gettable) (lua_State *L, int idx);219LUA_API void (lua_gettable) (lua_State *L, int idx);
219LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k);220LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k);
220LUA_API void (lua_rawget) (lua_State *L, int idx);221LUA_API void (lua_rawget) (lua_State *L, int idx);
221LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n);222LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n);
223LUA_API void (lua_rawgetp) (lua_State *L, int idx, const void *p);
222LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);224LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
223LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);225LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
224LUA_API int (lua_getmetatable) (lua_State *L, int objindex);226LUA_API int (lua_getmetatable) (lua_State *L, int objindex);
@@ -228,10 +230,12 @@ LUA_API void (lua_getuservalue) (lua_State *L, int idx); · 3 unmodified lines
228/*230/*
229** set functions (stack -> Lua)231** set functions (stack -> Lua)
230*/232*/
233LUA_API void (lua_setglobal) (lua_State *L, const char *var);
231LUA_API void (lua_settable) (lua_State *L, int idx);234LUA_API void (lua_settable) (lua_State *L, int idx);
232LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k);235LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k);
233LUA_API void (lua_rawset) (lua_State *L, int idx);236LUA_API void (lua_rawset) (lua_State *L, int idx);
234LUA_API void (lua_rawseti) (lua_State *L, int idx, int n);237LUA_API void (lua_rawseti) (lua_State *L, int idx, int n);
238LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p);
235LUA_API int (lua_setmetatable) (lua_State *L, int objindex);239LUA_API int (lua_setmetatable) (lua_State *L, int objindex);
236LUA_API void (lua_setuservalue) (lua_State *L, int idx);240LUA_API void (lua_setuservalue) (lua_State *L, int idx);
237 241
@@ -261,7 +265,7 @@ LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); · 23 unmodified lines
261LUA_API int (lua_yieldk) (lua_State *L, int nresults, int ctx,265LUA_API int (lua_yieldk) (lua_State *L, int nresults, int ctx,
262 lua_CFunction k);266 lua_CFunction k);
263#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL)267#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL)
264LUA_API int (lua_resume) (lua_State *L, int narg);268LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg);
265LUA_API int (lua_status) (lua_State *L);269LUA_API int (lua_status) (lua_State *L);
266 270
267/*271/*
@@ -314,13 +318,6 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); · 46 unmodified lines
314 318
315#define lua_newtable(L) lua_createtable(L, 0, 0)319#define lua_newtable(L) lua_createtable(L, 0, 0)
316 320
317#define lua_setglobal(L,s) \
318 (lua_pushglobaltable(L), lua_pushvalue(L, -2), \
319 lua_setfield(L, -2, (s)), lua_pop(L, 2))
320
321#define lua_getglobal(L,s) \
322 (lua_pushglobaltable(L), lua_getfield(L, -1, (s)), lua_remove(L, -2))
323
324#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))321#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
325 322
326#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)323#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)