diff options
-rw-r--r-- | README.md | 15 | ||||
-rw-r--r-- | c-api/compat-5.3.h | 12 |
2 files changed, 21 insertions, 6 deletions
@@ -144,9 +144,11 @@ For Lua 5.1 additionally: | |||
144 | * `LUA_OK` | 144 | * `LUA_OK` |
145 | * `LUA_ERRGCMM` | 145 | * `LUA_ERRGCMM` |
146 | * `LUA_OP*` macros for `lua_arith` and `lua_compare` | 146 | * `LUA_OP*` macros for `lua_arith` and `lua_compare` |
147 | * `LUA_FILEHANDLE` | ||
147 | * `lua_Unsigned` | 148 | * `lua_Unsigned` |
149 | * `luaL_Stream` (limited compatibility, see[here][19]) | ||
148 | * `lua_absindex` | 150 | * `lua_absindex` |
149 | * `lua_arith` (see [here][19]) | 151 | * `lua_arith` (see [here][20]) |
150 | * `lua_compare` | 152 | * `lua_compare` |
151 | * `lua_len`, `lua_rawlen`, and `luaL_len` | 153 | * `lua_len`, `lua_rawlen`, and `luaL_len` |
152 | * `lua_pushstring`, `lua_pushlstring` (return value) | 154 | * `lua_pushstring`, `lua_pushlstring` (return value) |
@@ -160,10 +162,10 @@ For Lua 5.1 additionally: | |||
160 | * `luaL_execresult` | 162 | * `luaL_execresult` |
161 | * `luaL_fileresult` | 163 | * `luaL_fileresult` |
162 | * `luaL_checkversion` (with empty body, only to avoid compile errors, | 164 | * `luaL_checkversion` (with empty body, only to avoid compile errors, |
163 | see [here][20]) | 165 | see [here][21]) |
164 | * `luaL_tolstring` | 166 | * `luaL_tolstring` |
165 | * `luaL_buffinitsize`, `luaL_prepbuffsize`, and `luaL_pushresultsize` | 167 | * `luaL_buffinitsize`, `luaL_prepbuffsize`, and `luaL_pushresultsize` |
166 | (see [here][21]) | 168 | (see [here][22]) |
167 | * `lua_pushunsigned`, `lua_tounsignedx`, `lua_tounsigned`, | 169 | * `lua_pushunsigned`, `lua_tounsignedx`, `lua_tounsigned`, |
168 | `luaL_checkunsigned`, `luaL_optunsigned`, if | 170 | `luaL_checkunsigned`, `luaL_optunsigned`, if |
169 | `LUA_COMPAT_APIINTCASTS` is defined. | 171 | `LUA_COMPAT_APIINTCASTS` is defined. |
@@ -225,7 +227,8 @@ This package contains code written by: | |||
225 | [17]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_setuservalue | 227 | [17]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_setuservalue |
226 | [18]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_stringtonumber | 228 | [18]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_stringtonumber |
227 | [19]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_arith | 229 | [19]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_arith |
228 | [20]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_checkversion | 230 | [20]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_Stream |
229 | [21]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_Buffer | 231 | [21]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_checkversion |
230 | [22]: https://github.com/keplerproject/lua-compat-5.3/wiki/coroutine.running | 232 | [22]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_Buffer |
233 | [23]: https://github.com/keplerproject/lua-compat-5.3/wiki/coroutine.running | ||
231 | 234 | ||
diff --git a/c-api/compat-5.3.h b/c-api/compat-5.3.h index 6c76930..a5b10d2 100644 --- a/c-api/compat-5.3.h +++ b/c-api/compat-5.3.h | |||
@@ -87,6 +87,9 @@ extern "C" { | |||
87 | #ifndef LUA_OPLE | 87 | #ifndef LUA_OPLE |
88 | # define LUA_OPLE 2 | 88 | # define LUA_OPLE 2 |
89 | #endif | 89 | #endif |
90 | #ifndef LUA_FILEHANDLE | ||
91 | # define LUA_FILEHANDLE "FILE*" | ||
92 | #endif | ||
90 | 93 | ||
91 | /* LuaJIT/Lua 5.1 does not have the updated | 94 | /* LuaJIT/Lua 5.1 does not have the updated |
92 | * error codes for thread status/function returns (but some patched versions do) | 95 | * error codes for thread status/function returns (but some patched versions do) |
@@ -112,6 +115,15 @@ typedef struct luaL_Buffer_53 { | |||
112 | } luaL_Buffer_53; | 115 | } luaL_Buffer_53; |
113 | #define luaL_Buffer luaL_Buffer_53 | 116 | #define luaL_Buffer luaL_Buffer_53 |
114 | 117 | ||
118 | /* | ||
119 | * In PUC-Rio 5.1, userdata is a simple FILE* | ||
120 | * In LuaJIT, it's a struct where the first member is a FILE* | ||
121 | * We can't support the `closef` member | ||
122 | */ | ||
123 | typedef struct luaL_Stream { | ||
124 | FILE *f; | ||
125 | } luaL_Stream; | ||
126 | |||
115 | #define lua_absindex COMPAT53_CONCAT(COMPAT53_PREFIX, _absindex) | 127 | #define lua_absindex COMPAT53_CONCAT(COMPAT53_PREFIX, _absindex) |
116 | COMPAT53_API int lua_absindex (lua_State *L, int i); | 128 | COMPAT53_API int lua_absindex (lua_State *L, int i); |
117 | 129 | ||