diff options
author | Philipp Janda <siffiejoe@gmx.net> | 2020-07-08 20:25:09 +0200 |
---|---|---|
committer | Philipp Janda <siffiejoe@gmx.net> | 2020-07-08 20:25:09 +0200 |
commit | 931652ad9ef34c99e53007de9f92bfd5a397a219 (patch) | |
tree | af2332578152b1ec65b3867e87c04ab2190734ad | |
parent | a1735f6e6bd17588fcaf98720f0548c4caa23b34 (diff) | |
download | lua-compat-5.3-931652ad9ef34c99e53007de9f92bfd5a397a219.tar.gz lua-compat-5.3-931652ad9ef34c99e53007de9f92bfd5a397a219.tar.bz2 lua-compat-5.3-931652ad9ef34c99e53007de9f92bfd5a397a219.zip |
Make it usable on Lua 5.4v0.8
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | c-api/compat-5.3.h | 6 | ||||
-rw-r--r-- | rockspecs/compat53-0.8-1.rockspec | 32 | ||||
-rw-r--r-- | rockspecs/compat53-scm-0.rockspec | 4 | ||||
-rw-r--r-- | tests/testmod.c | 2 |
5 files changed, 40 insertions, 6 deletions
@@ -35,7 +35,7 @@ require("compat53") | |||
35 | a meaningful return value, so the usual idiom of storing the return of | 35 | a meaningful return value, so the usual idiom of storing the return of |
36 | `require` in a local variable makes no sense. | 36 | `require` in a local variable makes no sense. |
37 | 37 | ||
38 | When run under Lua 5.3, this module does nothing. | 38 | When run under Lua 5.3+, this module does nothing. |
39 | 39 | ||
40 | When run under Lua 5.2 or 5.1, it replaces some of your standard | 40 | When run under Lua 5.2 or 5.1, it replaces some of your standard |
41 | functions and adds new ones to bring your environment closer to that | 41 | functions and adds new ones to bring your environment closer to that |
diff --git a/c-api/compat-5.3.h b/c-api/compat-5.3.h index 082a6a0..b730a4b 100644 --- a/c-api/compat-5.3.h +++ b/c-api/compat-5.3.h | |||
@@ -399,11 +399,11 @@ COMPAT53_API void luaL_requiref (lua_State *L, const char *modname, | |||
399 | 399 | ||
400 | 400 | ||
401 | /* other Lua versions */ | 401 | /* other Lua versions */ |
402 | #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 || LUA_VERSION_NUM > 503 | 402 | #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 || LUA_VERSION_NUM > 504 |
403 | 403 | ||
404 | # error "unsupported Lua version (i.e. not Lua 5.1, 5.2, or 5.3)" | 404 | # error "unsupported Lua version (i.e. not Lua 5.1, 5.2, 5.3, or 5.4)" |
405 | 405 | ||
406 | #endif /* other Lua versions except 5.1, 5.2, and 5.3 */ | 406 | #endif /* other Lua versions except 5.1, 5.2, 5.3, and 5.4 */ |
407 | 407 | ||
408 | 408 | ||
409 | 409 | ||
diff --git a/rockspecs/compat53-0.8-1.rockspec b/rockspecs/compat53-0.8-1.rockspec new file mode 100644 index 0000000..0ab17a0 --- /dev/null +++ b/rockspecs/compat53-0.8-1.rockspec | |||
@@ -0,0 +1,32 @@ | |||
1 | package = "compat53" | ||
2 | version = "0.8-1" | ||
3 | source = { | ||
4 | url = "https://github.com/keplerproject/lua-compat-5.3/archive/v0.8.zip", | ||
5 | dir = "lua-compat-5.3-0.8", | ||
6 | } | ||
7 | description = { | ||
8 | summary = "Compatibility module providing Lua-5.3-style APIs for Lua 5.2 and 5.1", | ||
9 | detailed = [[ | ||
10 | This is a small module that aims to make it easier to write Lua | ||
11 | code in a Lua-5.3-style that runs on Lua 5.1+. | ||
12 | It does *not* make Lua 5.2 (or even 5.1) entirely compatible | ||
13 | with Lua 5.3, but it brings the API closer to that of Lua 5.3. | ||
14 | ]], | ||
15 | homepage = "https://github.com/keplerproject/lua-compat-5.3", | ||
16 | license = "MIT" | ||
17 | } | ||
18 | dependencies = { | ||
19 | "lua >= 5.1, < 5.5", | ||
20 | --"struct" -- make Roberto's struct module optional | ||
21 | } | ||
22 | build = { | ||
23 | type = "builtin", | ||
24 | modules = { | ||
25 | ["compat53.init"] = "compat53/init.lua", | ||
26 | ["compat53.module"] = "compat53/module.lua", | ||
27 | ["compat53.utf8"] = "lutf8lib.c", | ||
28 | ["compat53.table"] = "ltablib.c", | ||
29 | ["compat53.string"] = "lstrlib.c", | ||
30 | } | ||
31 | } | ||
32 | |||
diff --git a/rockspecs/compat53-scm-0.rockspec b/rockspecs/compat53-scm-0.rockspec index 317e18c..a83dfca 100644 --- a/rockspecs/compat53-scm-0.rockspec +++ b/rockspecs/compat53-scm-0.rockspec | |||
@@ -8,7 +8,7 @@ description = { | |||
8 | summary = "Compatibility module providing Lua-5.3-style APIs for Lua 5.2 and 5.1", | 8 | summary = "Compatibility module providing Lua-5.3-style APIs for Lua 5.2 and 5.1", |
9 | detailed = [[ | 9 | detailed = [[ |
10 | This is a small module that aims to make it easier to write Lua | 10 | This is a small module that aims to make it easier to write Lua |
11 | code in a Lua-5.3-style that runs on Lua 5.3, 5.2, and 5.1. | 11 | code in a Lua-5.3-style that runs on Lua 5.1+. |
12 | It does *not* make Lua 5.2 (or even 5.1) entirely compatible | 12 | It does *not* make Lua 5.2 (or even 5.1) entirely compatible |
13 | with Lua 5.3, but it brings the API closer to that of Lua 5.3. | 13 | with Lua 5.3, but it brings the API closer to that of Lua 5.3. |
14 | ]], | 14 | ]], |
@@ -16,7 +16,7 @@ description = { | |||
16 | license = "MIT" | 16 | license = "MIT" |
17 | } | 17 | } |
18 | dependencies = { | 18 | dependencies = { |
19 | "lua >= 5.1, < 5.4", | 19 | "lua >= 5.1, < 5.5", |
20 | --"struct" -- make Roberto's struct module optional | 20 | --"struct" -- make Roberto's struct module optional |
21 | } | 21 | } |
22 | build = { | 22 | build = { |
diff --git a/tests/testmod.c b/tests/testmod.c index 3bf2cd3..0d73ed4 100644 --- a/tests/testmod.c +++ b/tests/testmod.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <errno.h> | ||
3 | #include "compat-5.3.h" | 4 | #include "compat-5.3.h" |
4 | 5 | ||
5 | 6 | ||
@@ -285,6 +286,7 @@ static int test_buffer (lua_State *L) { | |||
285 | 286 | ||
286 | static int test_exec (lua_State *L) { | 287 | static int test_exec (lua_State *L) { |
287 | const char *cmd = luaL_checkstring(L, 1); | 288 | const char *cmd = luaL_checkstring(L, 1); |
289 | errno = 0; | ||
288 | return luaL_execresult(L, system(cmd)); | 290 | return luaL_execresult(L, system(cmd)); |
289 | } | 291 | } |
290 | 292 | ||