| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | 
|  | 2 <HTML> | 
|  | 3 <HEAD> | 
|  | 4 <TITLE>Lua 5.2 readme</TITLE> | 
|  | 5 <LINK REL="stylesheet" TYPE="text/css" HREF="lua.css"> | 
|  | 6 <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-1"> | 
|  | 7 <STYLE TYPE="text/css"> | 
|  | 8 blockquote, .display { | 
|  | 9         border: solid #a0a0a0 2px ; | 
|  | 10         padding: 1em ; | 
|  | 11         margin: 0px ; | 
|  | 12 } | 
|  | 13 | 
|  | 14 .display { | 
|  | 15         word-spacing: 0.25em ; | 
|  | 16 } | 
|  | 17 | 
|  | 18 dl.display dd { | 
|  | 19         padding-bottom: 0.2em ; | 
|  | 20 } | 
|  | 21 | 
|  | 22 tt, kbd, code { | 
|  | 23         font-size: 12pt ; | 
|  | 24 } | 
|  | 25 </STYLE> | 
|  | 26 </HEAD> | 
|  | 27 | 
|  | 28 <BODY> | 
|  | 29 | 
|  | 30 <HR> | 
|  | 31 <H1> | 
|  | 32 <A HREF="http://www.lua.org/"><IMG SRC="logo.gif" ALT="Lua" BORDER=0></A> | 
|  | 33 Welcome to Lua 5.2 | 
|  | 34 </H1> | 
|  | 35 | 
|  | 36 <P> | 
|  | 37 <A HREF="#about">about</A> | 
|  | 38 · | 
|  | 39 <A HREF="#install">installation</A> | 
|  | 40 · | 
|  | 41 <A HREF="#changes">changes</A> | 
|  | 42 · | 
|  | 43 <A HREF="#license">license</A> | 
|  | 44 · | 
|  | 45 <A HREF="contents.html">reference manual</A> | 
|  | 46 | 
|  | 47 <H2><A NAME="about">About Lua</A></H2> | 
|  | 48 | 
|  | 49 <P> | 
|  | 50 Lua is a powerful, fast, lightweight, embeddable scripting language | 
|  | 51 developed by a | 
|  | 52 <A HREF="http://www.lua.org/authors.html">team</A> | 
|  | 53 at | 
|  | 54 <A HREF="http://www.puc-rio.br/">PUC-Rio</A>, | 
|  | 55 the Pontifical Catholic University of Rio de Janeiro in Brazil. | 
|  | 56 Lua is | 
|  | 57 <A HREF="#license">free software</A> | 
|  | 58 used in many products and projects around the world. | 
|  | 59 | 
|  | 60 <P> | 
|  | 61 Lua's | 
|  | 62 <A HREF="http://www.lua.org/">official web site</A> | 
|  | 63 provides complete information | 
|  | 64 about Lua, | 
|  | 65 including | 
|  | 66 an | 
|  | 67 <A HREF="http://www.lua.org/about.html">executive summary</A> | 
|  | 68 and | 
|  | 69 updated | 
|  | 70 <A HREF="http://www.lua.org/docs.html">documentation</A>, | 
|  | 71 especially the | 
|  | 72 <A HREF="http://www.lua.org/manual/5.2/">reference manual</A>, | 
|  | 73 which may differ slightly from the | 
|  | 74 <A HREF="contents.html">local copy</A> | 
|  | 75 distributed in this package. | 
|  | 76 | 
|  | 77 <H2><A NAME="install">Installing Lua</A></H2> | 
|  | 78 | 
|  | 79 <P> | 
|  | 80 Lua is distributed in | 
|  | 81 <A HREF="http://www.lua.org/ftp/">source</A> | 
|  | 82 form. | 
|  | 83 You need to build it before using it. | 
|  | 84 Building Lua should be straightforward | 
|  | 85 because | 
|  | 86 Lua is implemented in pure ANSI C and compiles unmodified in all known | 
|  | 87 platforms that have an ANSI C compiler. | 
|  | 88 Lua also compiles unmodified as C++. | 
|  | 89 The instructions given below for building Lua are for Unix-like platforms. | 
|  | 90 See also | 
|  | 91 <A HREF="#other">instructions for other systems</A> | 
|  | 92 and | 
|  | 93 <A HREF="#customization">customization options</A>. | 
|  | 94 | 
|  | 95 <P> | 
|  | 96 If you don't have the time or the inclination to compile Lua yourself, | 
|  | 97 get a binary from | 
|  | 98 <A HREF="http://lua-users.org/wiki/LuaBinaries">LuaBinaries</A>. | 
|  | 99 Try also | 
|  | 100 <A HREF="http://luaforwindows.luaforge.net/">Lua for Windows</A>, | 
|  | 101 an easy-to-use distribution of Lua that includes many useful libraries. | 
|  | 102 | 
|  | 103 <H3>Building Lua</H3> | 
|  | 104 | 
|  | 105 <P> | 
|  | 106 In most Unix-like platforms, simply do "<KBD>make</KBD>" with a suitable target. | 
|  | 107 Here are the details. | 
|  | 108 | 
|  | 109 <OL> | 
|  | 110 <LI> | 
|  | 111 Open a terminal window and move to | 
|  | 112 the top-level directory, which is named <TT>lua-5.2.2</TT>. | 
|  | 113 The Makefile there controls both the build process and the installation process. | 
|  | 114 <P> | 
|  | 115 <LI> | 
|  | 116   Do "<KBD>make</KBD>" and see if your platform is listed. | 
|  | 117   The platforms currently supported are: | 
|  | 118 <P> | 
|  | 119 <P CLASS="display"> | 
|  | 120    aix ansi bsd freebsd generic linux macosx mingw posix solaris | 
|  | 121 </P> | 
|  | 122 <P> | 
|  | 123   If your platform is listed, just do "<KBD>make xxx</KBD>", where xxx | 
|  | 124   is your platform name. | 
|  | 125 <P> | 
|  | 126   If your platform is not listed, try the closest one or posix, generic, | 
|  | 127   ansi, in this order. | 
|  | 128 <P> | 
|  | 129 <LI> | 
|  | 130 The compilation takes only a few moments | 
|  | 131 and produces three files in the <TT>src</TT> directory: | 
|  | 132 lua (the interpreter), | 
|  | 133 luac (the compiler), | 
|  | 134 and liblua.a (the library). | 
|  | 135 <P> | 
|  | 136 <LI> | 
|  | 137   To check that Lua has been built correctly, do "<KBD>make test</KBD>" | 
|  | 138   after building Lua. This will run the interpreter and print its version string
     . | 
|  | 139 </OL> | 
|  | 140 <P> | 
|  | 141 If you're running Linux and get compilation errors, | 
|  | 142 make sure you have installed the <TT>readline</TT> development package. | 
|  | 143 If you get link errors after that, | 
|  | 144 then try "<KBD>make linux MYLIBS=-ltermcap</KBD>". | 
|  | 145 | 
|  | 146 <H3>Installing Lua</H3> | 
|  | 147 <P> | 
|  | 148   Once you have built Lua, you may want to install it in an official | 
|  | 149   place in your system. In this case, do "<KBD>make install</KBD>". The official | 
|  | 150   place and the way to install files are defined in the Makefile. You'll | 
|  | 151   probably need the right permissions to install files. | 
|  | 152 | 
|  | 153 <P> | 
|  | 154   To build and install Lua in one step, do "<KBD>make xxx install</KBD>", | 
|  | 155   where xxx is your platform name. | 
|  | 156 | 
|  | 157 <P> | 
|  | 158   To install Lua locally, do "<KBD>make local</KBD>". | 
|  | 159   This will create a directory <TT>install</TT> with subdirectories | 
|  | 160   <TT>bin</TT>, <TT>include</TT>, <TT>lib</TT>, <TT>man</TT>, | 
|  | 161   and install Lua as listed below. | 
|  | 162 | 
|  | 163   To install Lua locally, but in some other directory, do | 
|  | 164   "<KBD>make install INSTALL_TOP=xxx</KBD>", where xxx is your chosen directory. | 
|  | 165 | 
|  | 166 <DL CLASS="display"> | 
|  | 167 <DT> | 
|  | 168     bin: | 
|  | 169 <DD> | 
|  | 170     lua luac | 
|  | 171 <DT> | 
|  | 172     include: | 
|  | 173 <DD> | 
|  | 174     lua.h luaconf.h lualib.h lauxlib.h lua.hpp | 
|  | 175 <DT> | 
|  | 176     lib: | 
|  | 177 <DD> | 
|  | 178     liblua.a | 
|  | 179 <DT> | 
|  | 180     man/man1: | 
|  | 181 <DD> | 
|  | 182     lua.1 luac.1 | 
|  | 183 </DL> | 
|  | 184 | 
|  | 185 <P> | 
|  | 186   These are the only directories you need for development. | 
|  | 187   If you only want to run Lua programs, | 
|  | 188   you only need the files in bin and man. | 
|  | 189   The files in include and lib are needed for | 
|  | 190   embedding Lua in C or C++ programs. | 
|  | 191 | 
|  | 192 <H3><A NAME="customization">Customization</A></H3> | 
|  | 193 <P> | 
|  | 194   Three kinds of things can be customized by editing a file: | 
|  | 195 <UL> | 
|  | 196     <LI> Where and how to install Lua — edit <TT>Makefile</TT>. | 
|  | 197     <LI> How to build Lua — edit <TT>src/Makefile</TT>. | 
|  | 198     <LI> Lua features — edit <TT>src/luaconf.h</TT>. | 
|  | 199 </UL> | 
|  | 200 | 
|  | 201 <P> | 
|  | 202   You don't actually need to edit the Makefiles because you may set the | 
|  | 203   relevant variables in the command line when invoking make. | 
|  | 204   Nevertheless, it's probably best to edit and save the Makefiles to | 
|  | 205   record the changes you need. | 
|  | 206 | 
|  | 207 <P> | 
|  | 208   On the other hand, if you need to customize some Lua features, you'll need | 
|  | 209   to edit <TT>src/luaconf.h</TT> before building and installing Lua. | 
|  | 210   The edited file will be the one installed, and | 
|  | 211   it will be used by any Lua clients that you build, to ensure consistency. | 
|  | 212   Further customization is available to experts by editing the Lua sources. | 
|  | 213 | 
|  | 214 <P> | 
|  | 215   We strongly recommend that you enable dynamic loading in <TT>src/luaconf.h</TT
     >. | 
|  | 216   This is done automatically for all platforms listed above that have | 
|  | 217   this feature and also for Windows. | 
|  | 218 | 
|  | 219 <H3><A NAME="other">Building Lua on other systems</A></H3> | 
|  | 220 | 
|  | 221 <P> | 
|  | 222   If you're not using the usual Unix tools, then the instructions for | 
|  | 223   building Lua depend on the compiler you use. You'll need to create | 
|  | 224   projects (or whatever your compiler uses) for building the library, | 
|  | 225   the interpreter, and the compiler, as follows: | 
|  | 226 | 
|  | 227 <DL CLASS="display"> | 
|  | 228 <DT> | 
|  | 229 library: | 
|  | 230 <DD> | 
|  | 231 lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c | 
|  | 232 lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c | 
|  | 233 ltm.c lundump.c lvm.c lzio.c | 
|  | 234 lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c | 
|  | 235 lmathlib.c loslib.c lstrlib.c ltablib.c loadlib.c linit.c | 
|  | 236 <DT> | 
|  | 237 interpreter: | 
|  | 238 <DD> | 
|  | 239   library, lua.c | 
|  | 240 <DT> | 
|  | 241 compiler: | 
|  | 242 <DD> | 
|  | 243   library, luac.c | 
|  | 244 </DL> | 
|  | 245 | 
|  | 246 <P> | 
|  | 247   To use Lua as a library in your own programs you'll need to know how to | 
|  | 248   create and use libraries with your compiler. Moreover, to dynamically load | 
|  | 249   C libraries for Lua you'll need to know how to create dynamic libraries | 
|  | 250   and you'll need to make sure that the Lua API functions are accessible to | 
|  | 251   those dynamic libraries — but <EM>don't</EM> link the Lua library | 
|  | 252   into each dynamic library. For Unix, we recommend that the Lua library | 
|  | 253   be linked statically into the host program and its symbols exported for | 
|  | 254   dynamic linking; <TT>src/Makefile</TT> does this for the Lua interpreter. | 
|  | 255   For Windows, we recommend that the Lua library be a DLL. | 
|  | 256 | 
|  | 257 <P> | 
|  | 258   As mentioned above, you may edit <TT>src/luaconf.h</TT> to customize | 
|  | 259   some features before building Lua. | 
|  | 260 | 
|  | 261 <H2><A NAME="changes">Changes since Lua 5.1</A></H2> | 
|  | 262 | 
|  | 263 <P> | 
|  | 264 Here are the main changes introduced in Lua 5.2. | 
|  | 265 The | 
|  | 266 <A HREF="contents.html">reference manual</A> | 
|  | 267 lists the | 
|  | 268 <A HREF="manual.html#8">incompatibilities</A> that had to be introduced. | 
|  | 269 | 
|  | 270 <H3>Main changes</H3> | 
|  | 271 <UL> | 
|  | 272 <LI> yieldable pcall and metamethods | 
|  | 273 <LI> new lexical scheme for globals | 
|  | 274 <LI> ephemeron tables | 
|  | 275 <LI> new library for bitwise operations | 
|  | 276 <LI> light C functions | 
|  | 277 <LI> emergency garbage collector | 
|  | 278 <LI> <CODE>goto</CODE> statement | 
|  | 279 <LI> finalizers for tables | 
|  | 280 </UL> | 
|  | 281 | 
|  | 282 Here are the other changes introduced in Lua 5.2: | 
|  | 283 <H3>Language</H3> | 
|  | 284 <UL> | 
|  | 285 <LI> no more fenv for threads or functions | 
|  | 286 <LI> tables honor the <CODE>__len</CODE> metamethod | 
|  | 287 <LI> hex and <CODE>\z</CODE> escapes in strings | 
|  | 288 <LI> support for hexadecimal floats | 
|  | 289 <LI> order metamethods work for different types | 
|  | 290 <LI> no more verification of opcode consistency | 
|  | 291 <LI> hook event "tail return" replaced by "tail call" | 
|  | 292 <LI> empty statement | 
|  | 293 <LI> <CODE>break</CODE> statement may appear in the middle of a block | 
|  | 294 </UL> | 
|  | 295 | 
|  | 296 <H3>Libraries</H3> | 
|  | 297 <UL> | 
|  | 298 <LI> arguments for function called through <CODE>xpcall</CODE> | 
|  | 299 <LI> optional 'mode' argument to load and loadfile (to control binary x text) | 
|  | 300 <LI> optional 'env' argument to load and loadfile (environment for loaded chunk) | 
|  | 301 <LI> <CODE>loadlib</CODE> may load libraries with global names (RTLD_GLOBAL) | 
|  | 302 <LI> new function <CODE>package.searchpath</CODE> | 
|  | 303 <LI> modules receive their paths when loaded | 
|  | 304 <LI> optional base in <CODE>math.log</CODE> | 
|  | 305 <LI> optional separator in <CODE>string.rep</CODE> | 
|  | 306 <LI> <CODE>file:write</CODE> returns <CODE>file</CODE> | 
|  | 307 <LI> closing a pipe returns exit status | 
|  | 308 <LI> <CODE>os.exit</CODE> may close state | 
|  | 309 <LI> new metamethods <CODE>__pairs</CODE> and <CODE>__ipairs</CODE> | 
|  | 310 <LI> new option 'isrunning' for <CODE>collectgarbage</CODE> and <CODE>lua_gc</CO
     DE> | 
|  | 311 <LI> frontier patterns | 
|  | 312 <LI> <CODE>\0</CODE> in patterns | 
|  | 313 <LI> new option <CODE>*L</CODE> for <CODE>io.read</CODE> | 
|  | 314 <LI> options for <CODE>io.lines</CODE> | 
|  | 315 <LI> <CODE>debug.getlocal</CODE> can access function varargs | 
|  | 316 </UL> | 
|  | 317 | 
|  | 318 <H3>C API</H3> | 
|  | 319 <UL> | 
|  | 320 <LI> main thread predefined in the registry | 
|  | 321 <LI> new functions | 
|  | 322 <CODE>lua_absindex</CODE>, | 
|  | 323 <CODE>lua_arith</CODE>, | 
|  | 324 <CODE>lua_compare</CODE>, | 
|  | 325 <CODE>lua_copy</CODE>, | 
|  | 326 <CODE>lua_len</CODE>, | 
|  | 327 <CODE>lua_rawgetp</CODE>, | 
|  | 328 <CODE>lua_rawsetp</CODE>, | 
|  | 329 <CODE>lua_upvalueid</CODE>, | 
|  | 330 <CODE>lua_upvaluejoin</CODE>, | 
|  | 331 <CODE>lua_version</CODE>. | 
|  | 332 <LI> new functions | 
|  | 333 <CODE>luaL_checkversion</CODE>, | 
|  | 334 <CODE>luaL_setmetatable</CODE>, | 
|  | 335 <CODE>luaL_testudata</CODE>, | 
|  | 336 <CODE>luaL_tolstring</CODE>. | 
|  | 337 <LI> <CODE>lua_pushstring</CODE> and <CODE>pushlstring</CODE> return string | 
|  | 338 <LI> <CODE>nparams</CODE> and <CODE>isvararg</CODE> available in debug API | 
|  | 339 <LI> new <CODE>lua_Unsigned</CODE> | 
|  | 340 </UL> | 
|  | 341 | 
|  | 342 <H3>Implementation</H3> | 
|  | 343 <UL> | 
|  | 344 <LI> max constants per function raised to 2<SUP>26</SUP> | 
|  | 345 <LI> generational mode for garbage collection (experimental) | 
|  | 346 <LI> NaN trick (experimental) | 
|  | 347 <LI> internal (immutable) version of ctypes | 
|  | 348 <LI> simpler implementation for string buffers | 
|  | 349 <LI> parser uses much less C-stack space (no more auto arrays) | 
|  | 350 </UL> | 
|  | 351 | 
|  | 352 <H3>Lua standalone interpreter</H3> | 
|  | 353 <UL> | 
|  | 354 <LI> new <CODE>-E</CODE> option to avoid environment variables | 
|  | 355 <LI> handling of non-string error messages | 
|  | 356 </UL> | 
|  | 357 | 
|  | 358 <H2><A NAME="license">License</A></H2> | 
|  | 359 <A HREF="http://www.opensource.org/docs/definition.php"> | 
|  | 360 <IMG SRC="osi-certified-72x60.png" ALIGN="right" BORDER="0" ALT="[osi certified]
     " STYLE="padding-left: 30px ;"> | 
|  | 361 </A> | 
|  | 362 | 
|  | 363 <P> | 
|  | 364 Lua is free software distributed under the terms of the | 
|  | 365 <A HREF="http://www.opensource.org/licenses/mit-license.html">MIT license</A> | 
|  | 366 reproduced below; | 
|  | 367 it may be used for any purpose, including commercial purposes, | 
|  | 368 at absolutely no cost without having to ask us. | 
|  | 369 | 
|  | 370 The only requirement is that if you do use Lua, | 
|  | 371 then you should give us credit by including the appropriate copyright notice som
     ewhere in your product or its documentation. | 
|  | 372 | 
|  | 373 For details, see | 
|  | 374 <A HREF="http://www.lua.org/license.html">this</A>. | 
|  | 375 | 
|  | 376 <BLOCKQUOTE STYLE="padding-bottom: 0em"> | 
|  | 377 Copyright © 1994–2013 Lua.org, PUC-Rio. | 
|  | 378 | 
|  | 379 <P> | 
|  | 380 Permission is hereby granted, free of charge, to any person obtaining a copy | 
|  | 381 of this software and associated documentation files (the "Software"), to deal | 
|  | 382 in the Software without restriction, including without limitation the rights | 
|  | 383 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 
|  | 384 copies of the Software, and to permit persons to whom the Software is | 
|  | 385 furnished to do so, subject to the following conditions: | 
|  | 386 | 
|  | 387 <P> | 
|  | 388 The above copyright notice and this permission notice shall be included in | 
|  | 389 all copies or substantial portions of the Software. | 
|  | 390 | 
|  | 391 <P> | 
|  | 392 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 
|  | 393 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 
|  | 394 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE | 
|  | 395 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 
|  | 396 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 
|  | 397 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | 
|  | 398 THE SOFTWARE. | 
|  | 399 </BLOCKQUOTE> | 
|  | 400 <P> | 
|  | 401 | 
|  | 402 <HR> | 
|  | 403 <SMALL CLASS="footer"> | 
|  | 404 Last update: | 
|  | 405 Fri Feb 22 09:24:20 BRT 2013 | 
|  | 406 </SMALL> | 
|  | 407 <!-- | 
|  | 408 Last change: revised for Lua 5.2.2 | 
|  | 409 --> | 
|  | 410 | 
|  | 411 </BODY> | 
|  | 412 </HTML> | 
| OLD | NEW | 
|---|