From c0db566ba0a42d5beebce46ba1af9273c85d7536 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 8 Sep 2017 18:19:30 +1000 Subject: Add LUA_FILEHANDLE define --- README.md | 1 + 1 file changed, 1 insertion(+) (limited to 'README.md') diff --git a/README.md b/README.md index 08614a1..8f0cc32 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,7 @@ For Lua 5.1 additionally: For Lua 5.1 additionally: * `LUA_OK` * `LUA_OP*` macros for `lua_arith` and `lua_compare` +* `LUA_FILEHANDLE` * `lua_Unsigned` * `lua_absindex` * `lua_arith` (see [here][19]) -- cgit v1.2.3-55-g6feb From c0a59dda383c37fdeb786de7b3fc4e58e2ab886d Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 8 Sep 2017 18:24:30 +1000 Subject: Add (partial) luaL_Stream definition --- README.md | 14 ++++++++------ c-api/compat-5.3.h | 9 +++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 8f0cc32..bc3ee28 100644 --- a/README.md +++ b/README.md @@ -144,8 +144,9 @@ For Lua 5.1 additionally: * `LUA_OP*` macros for `lua_arith` and `lua_compare` * `LUA_FILEHANDLE` * `lua_Unsigned` +* `luaL_Stream` (limited compatibility, see[here][19]) * `lua_absindex` -* `lua_arith` (see [here][19]) +* `lua_arith` (see [here][20]) * `lua_compare` * `lua_len`, `lua_rawlen`, and `luaL_len` * `lua_pushstring`, `lua_pushlstring` (return value) @@ -159,10 +160,10 @@ For Lua 5.1 additionally: * `luaL_execresult` * `luaL_fileresult` * `luaL_checkversion` (with empty body, only to avoid compile errors, - see [here][20]) + see [here][21]) * `luaL_tolstring` * `luaL_buffinitsize`, `luaL_prepbuffsize`, and `luaL_pushresultsize` - (see [here][21]) + (see [here][22]) * `lua_pushunsigned`, `lua_tounsignedx`, `lua_tounsigned`, `luaL_checkunsigned`, `luaL_optunsigned`, if `LUA_COMPAT_APIINTCASTS` is defined. @@ -224,7 +225,8 @@ This package contains code written by: [17]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_setuservalue [18]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_stringtonumber [19]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_arith - [20]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_checkversion - [21]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_Buffer - [22]: https://github.com/keplerproject/lua-compat-5.3/wiki/coroutine.running + [20]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_Stream + [21]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_checkversion + [22]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_Buffer + [23]: https://github.com/keplerproject/lua-compat-5.3/wiki/coroutine.running diff --git a/c-api/compat-5.3.h b/c-api/compat-5.3.h index 886b5ba..02712f3 100644 --- a/c-api/compat-5.3.h +++ b/c-api/compat-5.3.h @@ -102,6 +102,15 @@ typedef struct luaL_Buffer_53 { } luaL_Buffer_53; #define luaL_Buffer luaL_Buffer_53 +/* + * In PUC-Rio 5.1, userdata is a simple FILE* + * In LuaJIT, it's a struct where the first member is a FILE* + * We can't support the `closef` member + */ +typedef struct luaL_Stream { + FILE *f; +} luaL_Stream; + #define lua_absindex COMPAT53_CONCAT(COMPAT53_PREFIX, _absindex) COMPAT53_API int lua_absindex (lua_State *L, int i); -- cgit v1.2.3-55-g6feb