diff options
Diffstat (limited to 'lua.h')
| -rw-r--r-- | lua.h | 60 |
1 files changed, 32 insertions, 28 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.307 2014/06/10 17:41:38 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.308 2014/06/26 17:25:11 roberto Exp roberto $ |
| 3 | ** Lua - A Scripting Language | 3 | ** 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 file | 5 | ** See Copyright Notice at the end of this file |
| @@ -53,30 +53,6 @@ | |||
| 53 | 53 | ||
| 54 | typedef struct lua_State lua_State; | 54 | typedef struct lua_State lua_State; |
| 55 | 55 | ||
| 56 | /* | ||
| 57 | ** Type for C functions registered with Lua | ||
| 58 | */ | ||
| 59 | typedef int (*lua_CFunction) (lua_State *L); | ||
| 60 | |||
| 61 | /* | ||
| 62 | ** Type for continuation functions | ||
| 63 | */ | ||
| 64 | typedef int (*lua_KFunction) (lua_State *L, int status, int ctx); | ||
| 65 | |||
| 66 | |||
| 67 | /* | ||
| 68 | ** functions that read/write blocks when loading/dumping Lua chunks | ||
| 69 | */ | ||
| 70 | typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); | ||
| 71 | |||
| 72 | typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud); | ||
| 73 | |||
| 74 | |||
| 75 | /* | ||
| 76 | ** prototype for memory-allocation functions | ||
| 77 | */ | ||
| 78 | typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); | ||
| 79 | |||
| 80 | 56 | ||
| 81 | /* | 57 | /* |
| 82 | ** basic types | 58 | ** basic types |
| @@ -117,6 +93,34 @@ typedef LUA_INTEGER lua_Integer; | |||
| 117 | /* unsigned integer type */ | 93 | /* unsigned integer type */ |
| 118 | typedef LUA_UNSIGNED lua_Unsigned; | 94 | typedef LUA_UNSIGNED lua_Unsigned; |
| 119 | 95 | ||
| 96 | /* type for continuation-function contexts */ | ||
| 97 | typedef LUA_CTXT lua_Ctx; | ||
| 98 | |||
| 99 | |||
| 100 | /* | ||
| 101 | ** Type for C functions registered with Lua | ||
| 102 | */ | ||
| 103 | typedef int (*lua_CFunction) (lua_State *L); | ||
| 104 | |||
| 105 | /* | ||
| 106 | ** Type for continuation functions | ||
| 107 | */ | ||
| 108 | typedef int (*lua_KFunction) (lua_State *L, int status, lua_Ctx ctx); | ||
| 109 | |||
| 110 | |||
| 111 | /* | ||
| 112 | ** Type for functions that read/write blocks when loading/dumping Lua chunks | ||
| 113 | */ | ||
| 114 | typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); | ||
| 115 | |||
| 116 | typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud); | ||
| 117 | |||
| 118 | |||
| 119 | /* | ||
| 120 | ** Type for memory-allocation functions | ||
| 121 | */ | ||
| 122 | typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); | ||
| 123 | |||
| 120 | 124 | ||
| 121 | 125 | ||
| 122 | /* | 126 | /* |
| @@ -262,12 +266,12 @@ LUA_API void (lua_setuservalue) (lua_State *L, int idx); | |||
| 262 | /* | 266 | /* |
| 263 | ** 'load' and 'call' functions (load and run Lua code) | 267 | ** 'load' and 'call' functions (load and run Lua code) |
| 264 | */ | 268 | */ |
| 265 | LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, int ctx, | 269 | LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, lua_Ctx ctx, |
| 266 | lua_KFunction k); | 270 | lua_KFunction k); |
| 267 | #define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL) | 271 | #define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL) |
| 268 | 272 | ||
| 269 | LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, | 273 | LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, |
| 270 | int ctx, lua_KFunction k); | 274 | lua_Ctx ctx, lua_KFunction k); |
| 271 | #define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL) | 275 | #define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL) |
| 272 | 276 | ||
| 273 | LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, | 277 | LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, |
| @@ -280,7 +284,7 @@ LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip); | |||
| 280 | /* | 284 | /* |
| 281 | ** coroutine functions | 285 | ** coroutine functions |
| 282 | */ | 286 | */ |
| 283 | LUA_API int (lua_yieldk) (lua_State *L, int nresults, int ctx, | 287 | LUA_API int (lua_yieldk) (lua_State *L, int nresults, lua_Ctx ctx, |
| 284 | lua_KFunction k); | 288 | lua_KFunction k); |
| 285 | #define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) | 289 | #define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) |
| 286 | LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); | 290 | LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); |
