1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
4 <TITLE>Lua
5.3 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">
9 border: solid #a0a0a0
2px ;
16 word-spacing:
0.25em ;
20 padding-bottom:
0.2em ;
32 <A HREF=
"http://www.lua.org/"><IMG SRC=
"logo.gif" ALT=
"Lua"></A>
37 <A HREF=
"#about">about
</A>
39 <A HREF=
"#install">installation
</A>
41 <A HREF=
"#changes">changes
</A>
43 <A HREF=
"#license">license
</A>
45 <A HREF=
"contents.html">reference manual
</A>
48 <H2><A NAME=
"about">About Lua
</A></H2>
50 Lua is a powerful, fast, lightweight, embeddable scripting language
52 <A HREF=
"http://www.lua.org/authors.html">team
</A>
54 <A HREF=
"http://www.puc-rio.br/">PUC-Rio
</A>,
55 the Pontifical Catholic University of Rio de Janeiro in Brazil.
57 <A HREF=
"#license">free software
</A>
58 used in many products and projects around the world.
62 <A HREF=
"http://www.lua.org/">official web site
</A>
63 provides complete information
67 <A HREF=
"http://www.lua.org/about.html">executive summary
</A>
70 <A HREF=
"http://www.lua.org/docs.html">documentation
</A>,
72 <A HREF=
"http://www.lua.org/manual/5.3/">reference manual
</A>,
73 which may differ slightly from the
74 <A HREF=
"contents.html">local copy
</A>
75 distributed in this package.
77 <H2><A NAME=
"install">Installing Lua
</A></H2>
80 <A HREF=
"http://www.lua.org/ftp/">source
</A>
82 You need to build it before using it.
83 Building Lua should be straightforward
85 Lua is implemented in pure ANSI C and compiles unmodified in all known
86 platforms that have an ANSI C compiler.
87 Lua also compiles unmodified as C++.
88 The instructions given below for building Lua are for Unix-like platforms.
90 <A HREF=
"#other">instructions for other systems
</A>
92 <A HREF=
"#customization">customization options
</A>.
95 If you don't have the time or the inclination to compile Lua yourself,
97 <A HREF=
"http://lua-users.org/wiki/LuaBinaries">LuaBinaries
</A>.
99 <A HREF=
"http://luadist.org/">LuaDist
</A>,
100 a multi-platform distribution of Lua that includes batteries.
102 <H3>Building Lua
</H3>
104 In most Unix-like platforms, simply do
"<KBD>make</KBD>" with a suitable target.
105 Here are the details.
109 Open a terminal window and move to
110 the top-level directory, which is named
<TT>lua-
5.3.x
</TT>.
111 The
<TT>Makefile
</TT> there controls both the build process and the installation process.
114 Do
"<KBD>make</KBD>" and see if your platform is listed.
115 The platforms currently supported are:
118 aix bsd c89 freebsd generic linux macosx mingw posix solaris
121 If your platform is listed, just do
"<KBD>make xxx</KBD>", where xxx
122 is your platform name.
124 If your platform is not listed, try the closest one or posix, generic,
128 The compilation takes only a few moments
129 and produces three files in the
<TT>src
</TT> directory:
130 lua (the interpreter),
132 and liblua.a (the library).
135 To check that Lua has been built correctly, do
"<KBD>make test</KBD>"
136 after building Lua. This will run the interpreter and print its version.
139 If you're running Linux and get compilation errors,
140 make sure you have installed the
<TT>readline
</TT> development package
141 (which is probably named
<TT>libreadline-dev
</TT> or
<TT>readline-devel
</TT>).
142 If you get link errors after that,
143 then try
"<KBD>make linux MYLIBS=-ltermcap</KBD>".
145 <H3>Installing Lua
</H3>
147 Once you have built Lua, you may want to install it in an official
148 place in your system. In this case, do
"<KBD>make install</KBD>". The official
149 place and the way to install files are defined in the
<TT>Makefile
</TT>. You'll
150 probably need the right permissions to install files.
153 To build and install Lua in one step, do
"<KBD>make xxx install</KBD>",
154 where xxx is your platform name.
157 To install Lua locally, do
"<KBD>make local</KBD>".
158 This will create a directory
<TT>install
</TT> with subdirectories
159 <TT>bin
</TT>,
<TT>include
</TT>,
<TT>lib
</TT>,
<TT>man
</TT>,
<TT>share
</TT>,
160 and install Lua as listed below.
162 To install Lua locally, but in some other directory, do
163 "<KBD>make install INSTALL_TOP=xxx</KBD>", where xxx is your chosen directory.
164 The installation starts in the
<TT>src
</TT> and
<TT>doc
</TT> directories,
165 so take care if
<TT>INSTALL_TOP
</TT> is not an absolute path.
175 lua.h luaconf.h lualib.h lauxlib.h lua.hpp
187 These are the only directories you need for development.
188 If you only want to run Lua programs,
189 you only need the files in
<TT>bin
</TT> and
<TT>man
</TT>.
190 The files in
<TT>include
</TT> and
<TT>lib
</TT> are needed for
191 embedding Lua in C or C++ programs.
193 <H3><A NAME=
"customization">Customization
</A></H3>
195 Three kinds of things can be customized by editing a file:
197 <LI> Where and how to install Lua
— edit
<TT>Makefile
</TT>.
198 <LI> How to build Lua
— edit
<TT>src/Makefile
</TT>.
199 <LI> Lua features
— edit
<TT>src/luaconf.h
</TT>.
203 You don't actually need to edit the Makefiles because you may set the
204 relevant variables in the command line when invoking make.
205 Nevertheless, it's probably best to edit and save the Makefiles to
206 record the changes you've made.
209 On the other hand, if you need to customize some Lua features, you'll need
210 to edit
<TT>src/luaconf.h
</TT> before building and installing Lua.
211 The edited file will be the one installed, and
212 it will be used by any Lua clients that you build, to ensure consistency.
213 Further customization is available to experts by editing the Lua sources.
215 <H3><A NAME=
"other">Building Lua on other systems
</A></H3>
217 If you're not using the usual Unix tools, then the instructions for
218 building Lua depend on the compiler you use. You'll need to create
219 projects (or whatever your compiler uses) for building the library,
220 the interpreter, and the compiler, as follows:
226 lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c
227 lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c
228 ltm.c lundump.c lvm.c lzio.c
229 lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c
230 lmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c
242 To use Lua as a library in your own programs you'll need to know how to
243 create and use libraries with your compiler. Moreover, to dynamically load
244 C libraries for Lua you'll need to know how to create dynamic libraries
245 and you'll need to make sure that the Lua API functions are accessible to
246 those dynamic libraries
— but
<EM>don't
</EM> link the Lua library
247 into each dynamic library. For Unix, we recommend that the Lua library
248 be linked statically into the host program and its symbols exported for
249 dynamic linking;
<TT>src/Makefile
</TT> does this for the Lua interpreter.
250 For Windows, we recommend that the Lua library be a DLL.
251 In all cases, the compiler luac should be linked statically.
254 As mentioned above, you may edit
<TT>src/luaconf.h
</TT> to customize
255 some features before building Lua.
257 <H2><A NAME=
"changes">Changes since Lua
5.2</A></H2>
259 Here are the main changes introduced in Lua
5.3.
261 <A HREF=
"contents.html">reference manual
</A>
263 <A HREF=
"manual.html#8">incompatibilities
</A> that had to be introduced.
265 <H3>Main changes
</H3>
267 <LI> integers (
64-bit by default)
268 <LI> official support for
32-bit numbers
269 <LI> bitwise operators
270 <LI> basic utf-
8 support
271 <LI> functions for packing and unpacking values
275 Here are the other changes introduced in Lua
5.3:
278 <LI> userdata can have any Lua value as uservalue
279 <LI> integer division
280 <LI> more flexible rules for some metamethods
285 <LI> <CODE>ipairs
</CODE> and the table library respect metamethods
286 <LI> strip option in
<CODE>string.dump
</CODE>
287 <LI> table library respects metamethods
288 <LI> new function
<CODE>table.move
</CODE>
289 <LI> new function
<CODE>string.pack
</CODE>
290 <LI> new function
<CODE>string.unpack
</CODE>
291 <LI> new function
<CODE>string.packsize
</CODE>
296 <LI> simpler API for continuation functions in C
297 <LI> <CODE>lua_gettable
</CODE> and similar functions return type of resulted value
298 <LI> strip option in
<CODE>lua_dump
</CODE>
299 <LI> new function:
<CODE>lua_geti
</CODE>
300 <LI> new function:
<CODE>lua_seti
</CODE>
301 <LI> new function:
<CODE>lua_isyieldable
</CODE>
302 <LI> new function:
<CODE>lua_numbertointeger
</CODE>
303 <LI> new function:
<CODE>lua_rotate
</CODE>
304 <LI> new function:
<CODE>lua_stringtonumber
</CODE>
307 <H3>Lua standalone interpreter
</H3>
309 <LI> can be used as calculator; no need to prefix with '='
310 <LI> <CODE>arg
</CODE> table available to all code
313 <H2><A NAME=
"license">License
</A></H2>
315 <A HREF=
"http://www.opensource.org/docs/definition.php">
316 <IMG SRC=
"osi-certified-72x60.png" ALIGN=
"right" ALT=
"[osi certified]" STYLE=
"padding-left: 30px ;">
318 Lua is free software distributed under the terms of the
319 <A HREF=
"http://www.opensource.org/licenses/mit-license.html">MIT license
</A>
321 it may be used for any purpose, including commercial purposes,
322 at absolutely no cost without having to ask us.
324 The only requirement is that if you do use Lua,
325 then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation.
328 <A HREF=
"http://www.lua.org/license.html">this
</A>.
330 <BLOCKQUOTE STYLE=
"padding-bottom: 0em">
331 Copyright
© 1994–2015 Lua.org, PUC-Rio.
334 Permission is hereby granted, free of charge, to any person obtaining a copy
335 of this software and associated documentation files (the
"Software"), to deal
336 in the Software without restriction, including without limitation the rights
337 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
338 copies of the Software, and to permit persons to whom the Software is
339 furnished to do so, subject to the following conditions:
342 The above copyright notice and this permission notice shall be included in
343 all copies or substantial portions of the Software.
346 THE SOFTWARE IS PROVIDED
"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
347 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
348 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
349 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
350 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
351 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
358 Mon Jun
1 21:
48:
24 BRT
2015
361 Last change: revised for Lua 5.3.1