diff options
author | Philipp Janda <siffiejoe@gmx.net> | 2015-01-15 16:03:48 +0100 |
---|---|---|
committer | Philipp Janda <siffiejoe@gmx.net> | 2015-01-15 16:03:48 +0100 |
commit | 0a40bae847e6ac9f0e007b766cb5a87d61a85398 (patch) | |
tree | 6c46cd898596166c8d50c1c12632d0dd3503fe89 | |
parent | cdd787b876efe2e662ba7d6e8b9e38bf9f44bc04 (diff) | |
download | lua-compat-5.3-0a40bae847e6ac9f0e007b766cb5a87d61a85398.tar.gz lua-compat-5.3-0a40bae847e6ac9f0e007b766cb5a87d61a85398.tar.bz2 lua-compat-5.3-0a40bae847e6ac9f0e007b766cb5a87d61a85398.zip |
add rockspec and info for Lua API
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | README.md | 47 | ||||
-rw-r--r-- | rockspecs/compat53-scm-0.rockspec | 29 |
3 files changed, 69 insertions, 9 deletions
@@ -1,6 +1,8 @@ | |||
1 | # generated files | 1 | # generated files |
2 | *.so | 2 | *.so |
3 | *.dll | 3 | *.dll |
4 | *.o | ||
5 | *.obj | ||
4 | HISTO | 6 | HISTO |
5 | 7 | ||
6 | # vim temporaries | 8 | # vim temporaries |
@@ -12,6 +12,9 @@ compatible with Lua 5.3, but it brings the API closer to that of Lua | |||
12 | 12 | ||
13 | It includes: | 13 | It includes: |
14 | 14 | ||
15 | * _For writing Lua_: The Lua module `compat53`, which can be require'd | ||
16 | from Lua scripts and run in Lua 5.1, 5.2, and 5.3, including a | ||
17 | backport of the `utf8` module straight from the Lua 5.3 sources. | ||
15 | * _For writing C_: A C header and file which can be linked to your | 18 | * _For writing C_: A C header and file which can be linked to your |
16 | Lua module written in C, providing some functions from the C API | 19 | Lua module written in C, providing some functions from the C API |
17 | of Lua 5.3 that do not exist in Lua 5.2 or 5.1, making it easier to | 20 | of Lua 5.3 that do not exist in Lua 5.2 or 5.1, making it easier to |
@@ -19,6 +22,23 @@ It includes: | |||
19 | 22 | ||
20 | ## How to use it | 23 | ## How to use it |
21 | 24 | ||
25 | ### Lua module | ||
26 | |||
27 | ```lua | ||
28 | require("compat53") | ||
29 | ``` | ||
30 | |||
31 | `compat53` makes changes to your global environment and does not return | ||
32 | a meaningful return value, so the usual idiom of storing the return of | ||
33 | `require` in a local variable makes no sense. | ||
34 | |||
35 | When run under Lua 5.3, this module does nothing. | ||
36 | |||
37 | Wehn run under Lua 5.2 or 5.1, it replaces some of your standard | ||
38 | functions and adds new ondes to bring your environment closer to that | ||
39 | of Lua 5.3. It also loads the backported `utf8` module automatically, | ||
40 | and tries to use [Roberto's struct library][1]. | ||
41 | |||
22 | ### C code | 42 | ### C code |
23 | 43 | ||
24 | There are two ways of adding the C API compatibility functions/macros to | 44 | There are two ways of adding the C API compatibility functions/macros to |
@@ -37,6 +57,13 @@ your project: | |||
37 | 57 | ||
38 | ## What's implemented | 58 | ## What's implemented |
39 | 59 | ||
60 | ### Lua | ||
61 | |||
62 | * the `utf8` module backported from the Lua 5.3 sources | ||
63 | * `string.pack`, `string.packsize`, and `string.unpack` if the | ||
64 | `struct` module is available. (`struct` is not 100% compatible | ||
65 | to Lua 5.3's string packing!) | ||
66 | |||
40 | ### C | 67 | ### C |
41 | 68 | ||
42 | * `lua_KContext` | 69 | * `lua_KContext` |
@@ -53,7 +80,7 @@ your project: | |||
53 | * `lua_callk` and `lua_pcallk` (limited compatibility) | 80 | * `lua_callk` and `lua_pcallk` (limited compatibility) |
54 | * `lua_rawget` and `lua_rawgeti` (return values) | 81 | * `lua_rawget` and `lua_rawgeti` (return values) |
55 | * `lua_rawgetp` and `lua_rawsetp` | 82 | * `lua_rawgetp` and `lua_rawsetp` |
56 | * `luaL_requiref` (now checks `package.loaded`) | 83 | * `luaL_requiref` (now checks `package.loaded` first) |
57 | * `lua_rotate` | 84 | * `lua_rotate` |
58 | * `lua_stringtonumber` | 85 | * `lua_stringtonumber` |
59 | 86 | ||
@@ -82,9 +109,8 @@ For Lua 5.1 additionally: | |||
82 | 109 | ||
83 | * the new Lua functions of Lua 5.3 | 110 | * the new Lua functions of Lua 5.3 |
84 | * the table library doesn't respect metamethods yet | 111 | * the table library doesn't respect metamethods yet |
85 | * the utf8 library | 112 | * Lua 5.1: `_ENV`, `goto`, labels, ephemeron tables, etc. See |
86 | * string packing/unpacking | 113 | [`lua-compat-5.2`][2] for a detailed list. |
87 | * Lua 5.1: `_ENV`, `goto`, labels, ephemeron tables, etc. | ||
88 | * the following C API functions/macros: | 114 | * the following C API functions/macros: |
89 | * `lua_isyieldable` | 115 | * `lua_isyieldable` |
90 | * `lua_getextraspace` | 116 | * `lua_getextraspace` |
@@ -104,11 +130,9 @@ For Lua 5.1 additionally: | |||
104 | 130 | ||
105 | ## See also | 131 | ## See also |
106 | 132 | ||
107 | * For Lua-5.2-style APIs under Lua 5.1, see | 133 | * For Lua-5.2-style APIs under Lua 5.1, see [lua-compat-5.2][2], |
108 | [lua-compat-5.2](http://github.com/keplerproject/lua-compat-5.2/), | 134 | which also is the basis for most of the code in this project. |
109 | which also is the basis for most of the code in this project. | 135 | * For Lua-5.1-style APIs under Lua 5.0, see [Compat-5.1][3] |
110 | * For Lua-5.1-style APIs under Lua 5.0, see | ||
111 | [Compat-5.1](http://keplerproject.org/compat/) | ||
112 | 136 | ||
113 | ## Credits | 137 | ## Credits |
114 | 138 | ||
@@ -120,3 +144,8 @@ This package contains code written by: | |||
120 | * Hisham Muhammad ([@hishamhm](http://github.com/hishamhm)) | 144 | * Hisham Muhammad ([@hishamhm](http://github.com/hishamhm)) |
121 | * Renato Maia ([@renatomaia](http://github.com/renatomaia)) | 145 | * Renato Maia ([@renatomaia](http://github.com/renatomaia)) |
122 | 146 | ||
147 | |||
148 | [1]: http://www.inf.puc-rio.br/~roberto/struct/ | ||
149 | [2]: http://github.com/keplerproject/lua-compat-5.2/ | ||
150 | [3]: http://keplerproject.org/compat/ | ||
151 | |||
diff --git a/rockspecs/compat53-scm-0.rockspec b/rockspecs/compat53-scm-0.rockspec new file mode 100644 index 0000000..a7d0184 --- /dev/null +++ b/rockspecs/compat53-scm-0.rockspec | |||
@@ -0,0 +1,29 @@ | |||
1 | package = "compat53" | ||
2 | version = "scm-0" | ||
3 | source = { | ||
4 | url = "https://github.com/keplerproject/lua-compat-5.3/archive/master.zip", | ||
5 | dir = "lua-compat-5.3-master", | ||
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.3, 5.2, and 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.4", | ||
20 | --"struct" -- make Roberto's struct module optional | ||
21 | } | ||
22 | build = { | ||
23 | type = "builtin", | ||
24 | modules = { | ||
25 | ["compat53"] = "compat53.lua", | ||
26 | ["compat53.utf8"] = "lutf8lib.c", | ||
27 | } | ||
28 | } | ||
29 | |||