1280405Srpaulo<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2280405Srpaulo<HTML> 3280405Srpaulo<HEAD> 4280405Srpaulo<TITLE>Lua 5.3 readme</TITLE> 5280405Srpaulo<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css"> 6280405Srpaulo<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-1"> 7280405Srpaulo<STYLE TYPE="text/css"> 8280405Srpauloblockquote, .display { 9280405Srpaulo border: solid #a0a0a0 2px ; 10326344Simp border-radius: 8px ; 11280405Srpaulo padding: 1em ; 12280405Srpaulo margin: 0px ; 13280405Srpaulo} 14280405Srpaulo 15280405Srpaulo.display { 16280405Srpaulo word-spacing: 0.25em ; 17280405Srpaulo} 18280405Srpaulo 19280405Srpaulodl.display dd { 20280405Srpaulo padding-bottom: 0.2em ; 21280405Srpaulo} 22280405Srpaulo 23280405Srpaulott, kbd, code { 24280405Srpaulo font-size: 12pt ; 25280405Srpaulo} 26280405Srpaulo</STYLE> 27280405Srpaulo</HEAD> 28280405Srpaulo 29280405Srpaulo<BODY> 30280405Srpaulo 31280405Srpaulo<H1> 32326344Simp<A HREF="http://www.lua.org/"><IMG SRC="logo.gif" ALT="Lua"></A> 33326344SimpWelcome to Lua 5.3 34280405Srpaulo</H1> 35280405Srpaulo 36326344Simp<DIV CLASS="menubar"> 37280405Srpaulo<A HREF="#about">about</A> 38280405Srpaulo· 39280405Srpaulo<A HREF="#install">installation</A> 40280405Srpaulo· 41280405Srpaulo<A HREF="#changes">changes</A> 42280405Srpaulo· 43280405Srpaulo<A HREF="#license">license</A> 44280405Srpaulo· 45280405Srpaulo<A HREF="contents.html">reference manual</A> 46326344Simp</DIV> 47280405Srpaulo 48280405Srpaulo<H2><A NAME="about">About Lua</A></H2> 49280405Srpaulo<P> 50280405SrpauloLua is a powerful, fast, lightweight, embeddable scripting language 51280405Srpaulodeveloped by a 52280405Srpaulo<A HREF="http://www.lua.org/authors.html">team</A> 53280405Srpauloat 54280405Srpaulo<A HREF="http://www.puc-rio.br/">PUC-Rio</A>, 55280405Srpaulothe Pontifical Catholic University of Rio de Janeiro in Brazil. 56280405SrpauloLua is 57280405Srpaulo<A HREF="#license">free software</A> 58280405Srpauloused in many products and projects around the world. 59280405Srpaulo 60280405Srpaulo<P> 61280405SrpauloLua's 62280405Srpaulo<A HREF="http://www.lua.org/">official web site</A> 63280405Srpauloprovides complete information 64280405Srpauloabout Lua, 65280405Srpauloincluding 66280405Srpauloan 67280405Srpaulo<A HREF="http://www.lua.org/about.html">executive summary</A> 68280405Srpauloand 69280405Srpauloupdated 70280405Srpaulo<A HREF="http://www.lua.org/docs.html">documentation</A>, 71280405Srpauloespecially the 72280405Srpaulo<A HREF="http://www.lua.org/manual/5.3/">reference manual</A>, 73280405Srpaulowhich may differ slightly from the 74280405Srpaulo<A HREF="contents.html">local copy</A> 75280405Srpaulodistributed in this package. 76280405Srpaulo 77280405Srpaulo<H2><A NAME="install">Installing Lua</A></H2> 78280405Srpaulo<P> 79280405SrpauloLua is distributed in 80280405Srpaulo<A HREF="http://www.lua.org/ftp/">source</A> 81280405Srpauloform. 82280405SrpauloYou need to build it before using it. 83280405SrpauloBuilding Lua should be straightforward 84280405Srpaulobecause 85280405SrpauloLua is implemented in pure ANSI C and compiles unmodified in all known 86280405Srpauloplatforms that have an ANSI C compiler. 87280405SrpauloLua also compiles unmodified as C++. 88280405SrpauloThe instructions given below for building Lua are for Unix-like platforms. 89280405SrpauloSee also 90280405Srpaulo<A HREF="#other">instructions for other systems</A> 91280405Srpauloand 92280405Srpaulo<A HREF="#customization">customization options</A>. 93280405Srpaulo 94280405Srpaulo<P> 95280405SrpauloIf you don't have the time or the inclination to compile Lua yourself, 96280405Srpauloget a binary from 97280405Srpaulo<A HREF="http://lua-users.org/wiki/LuaBinaries">LuaBinaries</A>. 98280405SrpauloTry also 99280405Srpaulo<A HREF="http://luadist.org/">LuaDist</A>, 100280405Srpauloa multi-platform distribution of Lua that includes batteries. 101280405Srpaulo 102280405Srpaulo<H3>Building Lua</H3> 103280405Srpaulo<P> 104280405SrpauloIn most Unix-like platforms, simply do "<KBD>make</KBD>" with a suitable target. 105280405SrpauloHere are the details. 106280405Srpaulo 107280405Srpaulo<OL> 108280405Srpaulo<LI> 109280405SrpauloOpen a terminal window and move to 110344220Skevansthe top-level directory, which is named <TT>lua-5.3.5</TT>. 111280405SrpauloThe <TT>Makefile</TT> there controls both the build process and the installation process. 112280405Srpaulo<P> 113280405Srpaulo<LI> 114280405Srpaulo Do "<KBD>make</KBD>" and see if your platform is listed. 115280405Srpaulo The platforms currently supported are: 116280405Srpaulo<P> 117280405Srpaulo<P CLASS="display"> 118280405Srpaulo aix bsd c89 freebsd generic linux macosx mingw posix solaris 119280405Srpaulo</P> 120280405Srpaulo<P> 121280405Srpaulo If your platform is listed, just do "<KBD>make xxx</KBD>", where xxx 122280405Srpaulo is your platform name. 123280405Srpaulo<P> 124280405Srpaulo If your platform is not listed, try the closest one or posix, generic, 125280405Srpaulo c89, in this order. 126280405Srpaulo<P> 127280405Srpaulo<LI> 128280405SrpauloThe compilation takes only a few moments 129280405Srpauloand produces three files in the <TT>src</TT> directory: 130280405Srpaulolua (the interpreter), 131280405Srpauloluac (the compiler), 132280405Srpauloand liblua.a (the library). 133280405Srpaulo<P> 134280405Srpaulo<LI> 135280405Srpaulo To check that Lua has been built correctly, do "<KBD>make test</KBD>" 136280405Srpaulo after building Lua. This will run the interpreter and print its version. 137280405Srpaulo</OL> 138280405Srpaulo<P> 139280405SrpauloIf you're running Linux and get compilation errors, 140326344Simpmake sure you have installed the <TT>readline</TT> development package 141326344Simp(which is probably named <TT>libreadline-dev</TT> or <TT>readline-devel</TT>). 142280405SrpauloIf you get link errors after that, 143280405Srpaulothen try "<KBD>make linux MYLIBS=-ltermcap</KBD>". 144280405Srpaulo 145280405Srpaulo<H3>Installing Lua</H3> 146280405Srpaulo<P> 147280405Srpaulo Once you have built Lua, you may want to install it in an official 148280405Srpaulo place in your system. In this case, do "<KBD>make install</KBD>". The official 149280405Srpaulo place and the way to install files are defined in the <TT>Makefile</TT>. You'll 150280405Srpaulo probably need the right permissions to install files. 151280405Srpaulo 152280405Srpaulo<P> 153280405Srpaulo To build and install Lua in one step, do "<KBD>make xxx install</KBD>", 154280405Srpaulo where xxx is your platform name. 155280405Srpaulo 156280405Srpaulo<P> 157280405Srpaulo To install Lua locally, do "<KBD>make local</KBD>". 158280405Srpaulo This will create a directory <TT>install</TT> with subdirectories 159280405Srpaulo <TT>bin</TT>, <TT>include</TT>, <TT>lib</TT>, <TT>man</TT>, <TT>share</TT>, 160280405Srpaulo and install Lua as listed below. 161280405Srpaulo 162280405Srpaulo To install Lua locally, but in some other directory, do 163280405Srpaulo "<KBD>make install INSTALL_TOP=xxx</KBD>", where xxx is your chosen directory. 164280405Srpaulo The installation starts in the <TT>src</TT> and <TT>doc</TT> directories, 165280405Srpaulo so take care if <TT>INSTALL_TOP</TT> is not an absolute path. 166280405Srpaulo 167280405Srpaulo<DL CLASS="display"> 168280405Srpaulo<DT> 169280405Srpaulo bin: 170280405Srpaulo<DD> 171280405Srpaulo lua luac 172280405Srpaulo<DT> 173280405Srpaulo include: 174280405Srpaulo<DD> 175326344Simp lua.h luaconf.h lualib.h lauxlib.h lua.hpp 176280405Srpaulo<DT> 177280405Srpaulo lib: 178280405Srpaulo<DD> 179280405Srpaulo liblua.a 180280405Srpaulo<DT> 181280405Srpaulo man/man1: 182280405Srpaulo<DD> 183280405Srpaulo lua.1 luac.1 184280405Srpaulo</DL> 185280405Srpaulo 186280405Srpaulo<P> 187280405Srpaulo These are the only directories you need for development. 188280405Srpaulo If you only want to run Lua programs, 189280405Srpaulo you only need the files in <TT>bin</TT> and <TT>man</TT>. 190280405Srpaulo The files in <TT>include</TT> and <TT>lib</TT> are needed for 191280405Srpaulo embedding Lua in C or C++ programs. 192280405Srpaulo 193280405Srpaulo<H3><A NAME="customization">Customization</A></H3> 194280405Srpaulo<P> 195280405Srpaulo Three kinds of things can be customized by editing a file: 196280405Srpaulo<UL> 197280405Srpaulo <LI> Where and how to install Lua — edit <TT>Makefile</TT>. 198280405Srpaulo <LI> How to build Lua — edit <TT>src/Makefile</TT>. 199280405Srpaulo <LI> Lua features — edit <TT>src/luaconf.h</TT>. 200280405Srpaulo</UL> 201280405Srpaulo 202280405Srpaulo<P> 203280405Srpaulo You don't actually need to edit the Makefiles because you may set the 204280405Srpaulo relevant variables in the command line when invoking make. 205280405Srpaulo Nevertheless, it's probably best to edit and save the Makefiles to 206280405Srpaulo record the changes you've made. 207280405Srpaulo 208280405Srpaulo<P> 209280405Srpaulo On the other hand, if you need to customize some Lua features, you'll need 210280405Srpaulo to edit <TT>src/luaconf.h</TT> before building and installing Lua. 211280405Srpaulo The edited file will be the one installed, and 212280405Srpaulo it will be used by any Lua clients that you build, to ensure consistency. 213280405Srpaulo Further customization is available to experts by editing the Lua sources. 214280405Srpaulo 215280405Srpaulo<H3><A NAME="other">Building Lua on other systems</A></H3> 216280405Srpaulo<P> 217280405Srpaulo If you're not using the usual Unix tools, then the instructions for 218280405Srpaulo building Lua depend on the compiler you use. You'll need to create 219280405Srpaulo projects (or whatever your compiler uses) for building the library, 220280405Srpaulo the interpreter, and the compiler, as follows: 221280405Srpaulo 222280405Srpaulo<DL CLASS="display"> 223280405Srpaulo<DT> 224280405Srpaulolibrary: 225280405Srpaulo<DD> 226280405Srpaulolapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c 227280405Srpaulolmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c 228280405Srpauloltm.c lundump.c lvm.c lzio.c 229280405Srpaulolauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c 230280405Srpaulolmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c 231280405Srpaulo<DT> 232280405Srpaulointerpreter: 233280405Srpaulo<DD> 234280405Srpaulo library, lua.c 235280405Srpaulo<DT> 236280405Srpaulocompiler: 237280405Srpaulo<DD> 238280405Srpaulo library, luac.c 239280405Srpaulo</DL> 240280405Srpaulo 241280405Srpaulo<P> 242280405Srpaulo To use Lua as a library in your own programs you'll need to know how to 243280405Srpaulo create and use libraries with your compiler. Moreover, to dynamically load 244280405Srpaulo C libraries for Lua you'll need to know how to create dynamic libraries 245280405Srpaulo and you'll need to make sure that the Lua API functions are accessible to 246280405Srpaulo those dynamic libraries — but <EM>don't</EM> link the Lua library 247280405Srpaulo into each dynamic library. For Unix, we recommend that the Lua library 248280405Srpaulo be linked statically into the host program and its symbols exported for 249280405Srpaulo dynamic linking; <TT>src/Makefile</TT> does this for the Lua interpreter. 250280405Srpaulo For Windows, we recommend that the Lua library be a DLL. 251280405Srpaulo In all cases, the compiler luac should be linked statically. 252280405Srpaulo 253280405Srpaulo<P> 254280405Srpaulo As mentioned above, you may edit <TT>src/luaconf.h</TT> to customize 255280405Srpaulo some features before building Lua. 256280405Srpaulo 257280405Srpaulo<H2><A NAME="changes">Changes since Lua 5.2</A></H2> 258280405Srpaulo<P> 259280405SrpauloHere are the main changes introduced in Lua 5.3. 260280405SrpauloThe 261280405Srpaulo<A HREF="contents.html">reference manual</A> 262280405Srpaulolists the 263280405Srpaulo<A HREF="manual.html#8">incompatibilities</A> that had to be introduced. 264280405Srpaulo 265280405Srpaulo<H3>Main changes</H3> 266280405Srpaulo<UL> 267280405Srpaulo<LI> integers (64-bit by default) 268280405Srpaulo<LI> official support for 32-bit numbers 269280405Srpaulo<LI> bitwise operators 270280405Srpaulo<LI> basic utf-8 support 271280405Srpaulo<LI> functions for packing and unpacking values 272280405Srpaulo 273280405Srpaulo</UL> 274280405Srpaulo 275280405SrpauloHere are the other changes introduced in Lua 5.3: 276280405Srpaulo<H3>Language</H3> 277280405Srpaulo<UL> 278280405Srpaulo<LI> userdata can have any Lua value as uservalue 279326344Simp<LI> floor division 280280405Srpaulo<LI> more flexible rules for some metamethods 281280405Srpaulo</UL> 282280405Srpaulo 283280405Srpaulo<H3>Libraries</H3> 284280405Srpaulo<UL> 285280405Srpaulo<LI> <CODE>ipairs</CODE> and the table library respect metamethods 286280405Srpaulo<LI> strip option in <CODE>string.dump</CODE> 287280405Srpaulo<LI> table library respects metamethods 288280405Srpaulo<LI> new function <CODE>table.move</CODE> 289280405Srpaulo<LI> new function <CODE>string.pack</CODE> 290280405Srpaulo<LI> new function <CODE>string.unpack</CODE> 291280405Srpaulo<LI> new function <CODE>string.packsize</CODE> 292280405Srpaulo</UL> 293280405Srpaulo 294280405Srpaulo<H3>C API</H3> 295280405Srpaulo<UL> 296280405Srpaulo<LI> simpler API for continuation functions in C 297280405Srpaulo<LI> <CODE>lua_gettable</CODE> and similar functions return type of resulted value 298280405Srpaulo<LI> strip option in <CODE>lua_dump</CODE> 299280405Srpaulo<LI> new function: <CODE>lua_geti</CODE> 300280405Srpaulo<LI> new function: <CODE>lua_seti</CODE> 301280405Srpaulo<LI> new function: <CODE>lua_isyieldable</CODE> 302280405Srpaulo<LI> new function: <CODE>lua_numbertointeger</CODE> 303280405Srpaulo<LI> new function: <CODE>lua_rotate</CODE> 304280405Srpaulo<LI> new function: <CODE>lua_stringtonumber</CODE> 305280405Srpaulo</UL> 306280405Srpaulo 307280405Srpaulo<H3>Lua standalone interpreter</H3> 308280405Srpaulo<UL> 309280405Srpaulo<LI> can be used as calculator; no need to prefix with '=' 310280405Srpaulo<LI> <CODE>arg</CODE> table available to all code 311280405Srpaulo</UL> 312280405Srpaulo 313280405Srpaulo<H2><A NAME="license">License</A></H2> 314326344Simp<P> 315280405Srpaulo<A HREF="http://www.opensource.org/docs/definition.php"> 316326344Simp<IMG SRC="osi-certified-72x60.png" ALIGN="right" ALT="[osi certified]" STYLE="padding-left: 30px ;"> 317280405Srpaulo</A> 318280405SrpauloLua is free software distributed under the terms of the 319280405Srpaulo<A HREF="http://www.opensource.org/licenses/mit-license.html">MIT license</A> 320280405Srpauloreproduced below; 321280405Srpauloit may be used for any purpose, including commercial purposes, 322280405Srpauloat absolutely no cost without having to ask us. 323280405Srpaulo 324280405SrpauloThe only requirement is that if you do use Lua, 325280405Srpaulothen you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation. 326280405Srpaulo 327280405SrpauloFor details, see 328280405Srpaulo<A HREF="http://www.lua.org/license.html">this</A>. 329280405Srpaulo 330280405Srpaulo<BLOCKQUOTE STYLE="padding-bottom: 0em"> 331326344SimpCopyright © 1994–2017 Lua.org, PUC-Rio. 332280405Srpaulo 333280405Srpaulo<P> 334280405SrpauloPermission is hereby granted, free of charge, to any person obtaining a copy 335280405Srpauloof this software and associated documentation files (the "Software"), to deal 336280405Srpauloin the Software without restriction, including without limitation the rights 337280405Srpauloto use, copy, modify, merge, publish, distribute, sublicense, and/or sell 338280405Srpaulocopies of the Software, and to permit persons to whom the Software is 339280405Srpaulofurnished to do so, subject to the following conditions: 340280405Srpaulo 341280405Srpaulo<P> 342280405SrpauloThe above copyright notice and this permission notice shall be included in 343280405Srpauloall copies or substantial portions of the Software. 344280405Srpaulo 345280405Srpaulo<P> 346280405SrpauloTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 347280405SrpauloIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 348280405SrpauloFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 349280405SrpauloAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 350280405SrpauloLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 351280405SrpauloOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 352280405SrpauloTHE SOFTWARE. 353280405Srpaulo</BLOCKQUOTE> 354280405Srpaulo<P> 355280405Srpaulo 356326344Simp<P CLASS="footer"> 357280405SrpauloLast update: 358344220SkevansMon Jun 18 22:57:33 -03 2018 359326344Simp</P> 360280405Srpaulo<!-- 361344220SkevansLast change: revised for Lua 5.3.5 362280405Srpaulo--> 363280405Srpaulo 364280405Srpaulo</BODY> 365280405Srpaulo</HTML> 366