29
32
<A HREF="http://www.lua.org/"><IMG SRC="logo.gif" ALT="Lua" BORDER=0></A>
30
Welcome to Lua 5.2 (beta)
34
<IMG SRC="alert.png" ALIGN="absbottom" ALT="[!]">
35
<EM>This is a beta version of Lua 5.2.
36
Some details may change in the final version.</EM>
39
37
<A HREF="#about">about</A>
41
39
<A HREF="#install">installation</A>
86
84
You need to build it before using it.
87
85
Building Lua should be straightforward
89
Lua is implemented in pure ANSI C, and compiles unmodified in all known
87
Lua is implemented in pure ANSI C and compiles unmodified in all known
90
88
platforms that have an ANSI C compiler.
91
89
Lua also compiles unmodified as C++.
92
90
The instructions given below for building Lua are for Unix-like platforms.
122
120
Open a terminal window and move to
123
the top-level directory, which is named lua-5.2.0.
121
the top-level directory, which is named <TT>lua-5.2.0</TT>.
124
122
The Makefile there controls both the build process and the installation process.
127
125
Do "<KBD>make</KBD>" and see if your platform is listed.
128
126
The platforms currently supported are:
130
aix ansi bsd freebsd generic linux macosx mingw posix solaris
129
aix ansi bsd freebsd generic linux macosx mingw posix solaris
133
132
If your platform is listed, just do "<KBD>make xxx</KBD>", where xxx
134
133
is your platform name.
147
146
To check that Lua has been built correctly, do "<KBD>make test</KBD>"
148
147
after building Lua. This will run the interpreter and print its version string.
150
If you're running Linux and get compilation errors,
151
make sure you have installed the <TT>readline</TT> development package.
151
153
<H3>Installing Lua</H3>
153
155
Once you have built Lua, you may want to install it in an official
154
156
place in your system. In this case, do "<KBD>make install</KBD>". The official
155
place and the way to install files are defined in Makefile. You'll
157
place and the way to install files are defined in the Makefile. You'll
156
158
probably need the right permissions to install files.
199
201
Three kinds of things can be customized by editing a file:
201
<LI> Where and how to install Lua — edit Makefile.
202
<LI> How to build Lua — edit src/Makefile.
203
<LI> Lua features — edit src/luaconf.h.
203
<LI> Where and how to install Lua — edit <TT>Makefile</TT>.
204
<LI> How to build Lua — edit <TT>src/Makefile</TT>.
205
<LI> Lua features — edit <TT>src/luaconf.h</TT>.
213
215
On the other hand, if you need to customize some Lua features, you'll need
214
to edit src/luaconf.h before building and installing Lua.
216
to edit <TT>src/luaconf.h</TT> before building and installing Lua.
215
217
The edited file will be the one installed, and
216
218
it will be used by any Lua clients that you build, to ensure consistency.
217
219
Further customization is available to experts by editing the Lua sources.
220
We strongly recommend that you enable dynamic loading in src/luaconf.h.
222
We strongly recommend that you enable dynamic loading in <TT>src/luaconf.h</TT>.
221
223
This is done automatically for all platforms listed above that have
222
224
this feature and also for Windows.
257
258
those dynamic libraries — but <EM>don't</EM> link the Lua library
258
259
into each dynamic library. For Unix, we recommend that the Lua library
259
260
be linked statically into the host program and its symbols exported for
260
dynamic linking; src/Makefile does this for the Lua interpreter.
261
dynamic linking; <TT>src/Makefile</TT> does this for the Lua interpreter.
261
262
For Windows, we recommend that the Lua library be a DLL.
264
As mentioned above, you may edit src/luaconf.h to customize
265
As mentioned above, you may edit <TT>src/luaconf.h</TT> to customize
265
266
some features before building Lua.
267
268
<H2><A NAME="changes">Changes since Lua 5.1</A></H2>
291
292
<LI> no more fenv for threads or functions
292
293
<LI> tables honor the <CODE>__len</CODE> metamethod
293
<LI> hex and <CODE>\*</CODE> escapes in strings
294
<LI> hex and <CODE>\z</CODE> escapes in strings
294
295
<LI> support for hexadecimal floats
295
296
<LI> order metamethods work for different types
296
297
<LI> no more verification of opcode consistency
302
303
<H3>Libraries</H3>
304
305
<LI> arguments for function called through <CODE>xpcall</CODE>
305
<LI> optional 'mode' argument to load (to control binary x text)
306
<LI> optional 'env' argument to load (environment for loaded chunk)
306
<LI> optional 'mode' argument to load and loadfile (to control binary x text)
307
<LI> optional 'env' argument to load and loadfile (environment for loaded chunk)
307
308
<LI> <CODE>loadlib</CODE> may load libraries with global names (RTLD_GLOBAL)
308
309
<LI> new function <CODE>package.searchpath</CODE>
309
310
<LI> modules receive their paths when loaded
326
327
<LI> main thread predefined in the registry
327
<LI> new constants <CODE>LUA_OK</CODE> and <CODE>LUA_ERRGCMM</CODE>
328
<LI> new <CODE>lua_compare</CODE>, <CODE>lua_arith</CODE>, and <CODE>lua_len</CODE>
329
<LI> new <CODE>lua_version</CODE> and <CODE>luaL_checkversion</CODE>
329
<CODE>lua_absindex</CODE>,
330
<CODE>lua_arith</CODE>,
331
<CODE>lua_compare</CODE>,
332
<CODE>lua_copy</CODE>,
333
<CODE>lua_len</CODE>,
334
<CODE>lua_rawgetp</CODE>,
335
<CODE>lua_rawsetp</CODE>,
336
<CODE>lua_upvalueid</CODE>,
337
<CODE>lua_upvaluejoin</CODE>,
338
<CODE>lua_version</CODE>.
340
<CODE>luaL_checkversion</CODE>,
341
<CODE>luaL_setmetatable</CODE>,
342
<CODE>luaL_testudata</CODE>,
343
<CODE>luaL_tolstring</CODE>.
330
344
<LI> <CODE>lua_pushstring</CODE> and <CODE>pushlstring</CODE> return string
331
<LI> new <CODE>luaL_testudata</CODE> and <CODE>luaL_setmetatable</CODE>
332
<LI> new <CODE>luaL_tolstring</CODE>
333
<LI> new <CODE>lua_copy</CODE>
334
<LI> new <CODE>lua_absindex</CODE>
335
<LI> new <CODE>lua_upvalueid</CODE> and <CODE>lua_upvaluejoin</CODE>
336
345
<LI> <CODE>nparams</CODE> and <CODE>isvararg</CODE> available in debug API
337
346
<LI> new <CODE>lua_Unsigned</CODE>
340
349
<H3>Implementation</H3>
342
351
<LI> max constants per function raised to 2<SUP>26</SUP>
352
<LI> generational mode for garbage collection (experimental)
353
<LI> NaN trick (experimental)
343
354
<LI> internal (immutable) version of ctypes
344
355
<LI> simpler implementation for string buffers
345
<LI> udata with finalizers are kept in a separated list for the GC
346
<LI> <CODE>CallInfo</CODE> stack now is a linked list
347
356
<LI> parser uses much less C-stack space (no more auto arrays)
348
<LI> new hash for floats
349
<LI> handling of non-string error messages in the standalone interpreter
350
<LI> generational mode for garbage collection (experimental)
351
<LI> NaN trick (experimental)
359
<H3>Lua standalone interpreter</H3>
361
<LI> new <CODE>-E</CODE> option to avoid environment variables
362
<LI> handling of non-string error messages
354
365
<H2><A NAME="license">License</A></H2>
393
404
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
398
410
<SMALL CLASS="footer">
400
Fri Jun 24 11:30:57 BRT 2011
412
Wed Nov 23 16:17:22 BRST 2011
403
Last change: revised for Lua 5.2.0 (beta)
415
Last change: revised for Lua 5.2.0