readme.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  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">
  8. blockquote, .display {
  9. border: solid #a0a0a0 2px ;
  10. border-radius: 8px ;
  11. padding: 1em ;
  12. margin: 0px ;
  13. }
  14. .display {
  15. word-spacing: 0.25em ;
  16. }
  17. dl.display dd {
  18. padding-bottom: 0.2em ;
  19. }
  20. tt, kbd, code {
  21. font-size: 12pt ;
  22. }
  23. </STYLE>
  24. </HEAD>
  25. <BODY>
  26. <H1>
  27. <A HREF="http://www.lua.org/"><IMG SRC="logo.gif" ALT="Lua"></A>
  28. Welcome to Lua 5.3
  29. </H1>
  30. <DIV CLASS="menubar">
  31. <A HREF="#about">about</A>
  32. &middot;
  33. <A HREF="#install">installation</A>
  34. &middot;
  35. <A HREF="#changes">changes</A>
  36. &middot;
  37. <A HREF="#license">license</A>
  38. &middot;
  39. <A HREF="contents.html">reference manual</A>
  40. </DIV>
  41. <H2><A NAME="about">About Lua</A></H2>
  42. <P>
  43. Lua is a powerful, fast, lightweight, embeddable scripting language
  44. developed by a
  45. <A HREF="http://www.lua.org/authors.html">team</A>
  46. at
  47. <A HREF="http://www.puc-rio.br/">PUC-Rio</A>,
  48. the Pontifical Catholic University of Rio de Janeiro in Brazil.
  49. Lua is
  50. <A HREF="#license">free software</A>
  51. used in many products and projects around the world.
  52. <P>
  53. Lua's
  54. <A HREF="http://www.lua.org/">official web site</A>
  55. provides complete information
  56. about Lua,
  57. including
  58. an
  59. <A HREF="http://www.lua.org/about.html">executive summary</A>
  60. and
  61. updated
  62. <A HREF="http://www.lua.org/docs.html">documentation</A>,
  63. especially the
  64. <A HREF="http://www.lua.org/manual/5.3/">reference manual</A>,
  65. which may differ slightly from the
  66. <A HREF="contents.html">local copy</A>
  67. distributed in this package.
  68. <H2><A NAME="install">Installing Lua</A></H2>
  69. <P>
  70. Lua is distributed in
  71. <A HREF="http://www.lua.org/ftp/">source</A>
  72. form.
  73. You need to build it before using it.
  74. Building Lua should be straightforward
  75. because
  76. Lua is implemented in pure ANSI C and compiles unmodified in all known
  77. platforms that have an ANSI C compiler.
  78. Lua also compiles unmodified as C++.
  79. The instructions given below for building Lua are for Unix-like platforms.
  80. See also
  81. <A HREF="#other">instructions for other systems</A>
  82. and
  83. <A HREF="#customization">customization options</A>.
  84. <P>
  85. If you don't have the time or the inclination to compile Lua yourself,
  86. get a binary from
  87. <A HREF="http://lua-users.org/wiki/LuaBinaries">LuaBinaries</A>.
  88. Try also
  89. <A HREF="http://luadist.org/">LuaDist</A>,
  90. a multi-platform distribution of Lua that includes batteries.
  91. <H3>Building Lua</H3>
  92. <P>
  93. In most Unix-like platforms, simply do "<KBD>make</KBD>" with a suitable target.
  94. Here are the details.
  95. <OL>
  96. <LI>
  97. Open a terminal window and move to
  98. the top-level directory, which is named <TT>lua-5.3.5</TT>.
  99. The <TT>Makefile</TT> there controls both the build process and the installation process.
  100. <P>
  101. <LI>
  102. Do "<KBD>make</KBD>" and see if your platform is listed.
  103. The platforms currently supported are:
  104. <P>
  105. <P CLASS="display">
  106. aix bsd c89 freebsd generic linux macosx mingw posix solaris
  107. </P>
  108. <P>
  109. If your platform is listed, just do "<KBD>make xxx</KBD>", where xxx
  110. is your platform name.
  111. <P>
  112. If your platform is not listed, try the closest one or posix, generic,
  113. c89, in this order.
  114. <P>
  115. <LI>
  116. The compilation takes only a few moments
  117. and produces three files in the <TT>src</TT> directory:
  118. lua (the interpreter),
  119. luac (the compiler),
  120. and liblua.a (the library).
  121. <P>
  122. <LI>
  123. To check that Lua has been built correctly, do "<KBD>make test</KBD>"
  124. after building Lua. This will run the interpreter and print its version.
  125. </OL>
  126. <P>
  127. If you're running Linux and get compilation errors,
  128. make sure you have installed the <TT>readline</TT> development package
  129. (which is probably named <TT>libreadline-dev</TT> or <TT>readline-devel</TT>).
  130. If you get link errors after that,
  131. then try "<KBD>make linux MYLIBS=-ltermcap</KBD>".
  132. <H3>Installing Lua</H3>
  133. <P>
  134. Once you have built Lua, you may want to install it in an official
  135. place in your system. In this case, do "<KBD>make install</KBD>". The official
  136. place and the way to install files are defined in the <TT>Makefile</TT>. You'll
  137. probably need the right permissions to install files.
  138. <P>
  139. To build and install Lua in one step, do "<KBD>make xxx install</KBD>",
  140. where xxx is your platform name.
  141. <P>
  142. To install Lua locally, do "<KBD>make local</KBD>".
  143. This will create a directory <TT>install</TT> with subdirectories
  144. <TT>bin</TT>, <TT>include</TT>, <TT>lib</TT>, <TT>man</TT>, <TT>share</TT>,
  145. and install Lua as listed below.
  146. To install Lua locally, but in some other directory, do
  147. "<KBD>make install INSTALL_TOP=xxx</KBD>", where xxx is your chosen directory.
  148. The installation starts in the <TT>src</TT> and <TT>doc</TT> directories,
  149. so take care if <TT>INSTALL_TOP</TT> is not an absolute path.
  150. <DL CLASS="display">
  151. <DT>
  152. bin:
  153. <DD>
  154. lua luac
  155. <DT>
  156. include:
  157. <DD>
  158. lua.h luaconf.h lualib.h lauxlib.h lua.hpp
  159. <DT>
  160. lib:
  161. <DD>
  162. liblua.a
  163. <DT>
  164. man/man1:
  165. <DD>
  166. lua.1 luac.1
  167. </DL>
  168. <P>
  169. These are the only directories you need for development.
  170. If you only want to run Lua programs,
  171. you only need the files in <TT>bin</TT> and <TT>man</TT>.
  172. The files in <TT>include</TT> and <TT>lib</TT> are needed for
  173. embedding Lua in C or C++ programs.
  174. <H3><A NAME="customization">Customization</A></H3>
  175. <P>
  176. Three kinds of things can be customized by editing a file:
  177. <UL>
  178. <LI> Where and how to install Lua &mdash; edit <TT>Makefile</TT>.
  179. <LI> How to build Lua &mdash; edit <TT>src/Makefile</TT>.
  180. <LI> Lua features &mdash; edit <TT>src/luaconf.h</TT>.
  181. </UL>
  182. <P>
  183. You don't actually need to edit the Makefiles because you may set the
  184. relevant variables in the command line when invoking make.
  185. Nevertheless, it's probably best to edit and save the Makefiles to
  186. record the changes you've made.
  187. <P>
  188. On the other hand, if you need to customize some Lua features, you'll need
  189. to edit <TT>src/luaconf.h</TT> before building and installing Lua.
  190. The edited file will be the one installed, and
  191. it will be used by any Lua clients that you build, to ensure consistency.
  192. Further customization is available to experts by editing the Lua sources.
  193. <H3><A NAME="other">Building Lua on other systems</A></H3>
  194. <P>
  195. If you're not using the usual Unix tools, then the instructions for
  196. building Lua depend on the compiler you use. You'll need to create
  197. projects (or whatever your compiler uses) for building the library,
  198. the interpreter, and the compiler, as follows:
  199. <DL CLASS="display">
  200. <DT>
  201. library:
  202. <DD>
  203. lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c
  204. lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c
  205. ltm.c lundump.c lvm.c lzio.c
  206. lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c
  207. lmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c
  208. <DT>
  209. interpreter:
  210. <DD>
  211. library, lua.c
  212. <DT>
  213. compiler:
  214. <DD>
  215. library, luac.c
  216. </DL>
  217. <P>
  218. To use Lua as a library in your own programs you'll need to know how to
  219. create and use libraries with your compiler. Moreover, to dynamically load
  220. C libraries for Lua you'll need to know how to create dynamic libraries
  221. and you'll need to make sure that the Lua API functions are accessible to
  222. those dynamic libraries &mdash; but <EM>don't</EM> link the Lua library
  223. into each dynamic library. For Unix, we recommend that the Lua library
  224. be linked statically into the host program and its symbols exported for
  225. dynamic linking; <TT>src/Makefile</TT> does this for the Lua interpreter.
  226. For Windows, we recommend that the Lua library be a DLL.
  227. In all cases, the compiler luac should be linked statically.
  228. <P>
  229. As mentioned above, you may edit <TT>src/luaconf.h</TT> to customize
  230. some features before building Lua.
  231. <H2><A NAME="changes">Changes since Lua 5.2</A></H2>
  232. <P>
  233. Here are the main changes introduced in Lua 5.3.
  234. The
  235. <A HREF="contents.html">reference manual</A>
  236. lists the
  237. <A HREF="manual.html#8">incompatibilities</A> that had to be introduced.
  238. <H3>Main changes</H3>
  239. <UL>
  240. <LI> integers (64-bit by default)
  241. <LI> official support for 32-bit numbers
  242. <LI> bitwise operators
  243. <LI> basic utf-8 support
  244. <LI> functions for packing and unpacking values
  245. </UL>
  246. Here are the other changes introduced in Lua 5.3:
  247. <H3>Language</H3>
  248. <UL>
  249. <LI> userdata can have any Lua value as uservalue
  250. <LI> floor division
  251. <LI> more flexible rules for some metamethods
  252. </UL>
  253. <H3>Libraries</H3>
  254. <UL>
  255. <LI> <CODE>ipairs</CODE> and the table library respect metamethods
  256. <LI> strip option in <CODE>string.dump</CODE>
  257. <LI> table library respects metamethods
  258. <LI> new function <CODE>table.move</CODE>
  259. <LI> new function <CODE>string.pack</CODE>
  260. <LI> new function <CODE>string.unpack</CODE>
  261. <LI> new function <CODE>string.packsize</CODE>
  262. </UL>
  263. <H3>C API</H3>
  264. <UL>
  265. <LI> simpler API for continuation functions in C
  266. <LI> <CODE>lua_gettable</CODE> and similar functions return type of resulted value
  267. <LI> strip option in <CODE>lua_dump</CODE>
  268. <LI> new function: <CODE>lua_geti</CODE>
  269. <LI> new function: <CODE>lua_seti</CODE>
  270. <LI> new function: <CODE>lua_isyieldable</CODE>
  271. <LI> new function: <CODE>lua_numbertointeger</CODE>
  272. <LI> new function: <CODE>lua_rotate</CODE>
  273. <LI> new function: <CODE>lua_stringtonumber</CODE>
  274. </UL>
  275. <H3>Lua standalone interpreter</H3>
  276. <UL>
  277. <LI> can be used as calculator; no need to prefix with '='
  278. <LI> <CODE>arg</CODE> table available to all code
  279. </UL>
  280. <H2><A NAME="license">License</A></H2>
  281. <P>
  282. <A HREF="http://www.opensource.org/docs/definition.php">
  283. <IMG SRC="osi-certified-72x60.png" ALIGN="right" ALT="[osi certified]" STYLE="padding-left: 30px ;">
  284. </A>
  285. Lua is free software distributed under the terms of the
  286. <A HREF="http://www.opensource.org/licenses/mit-license.html">MIT license</A>
  287. reproduced below;
  288. it may be used for any purpose, including commercial purposes,
  289. at absolutely no cost without having to ask us.
  290. The only requirement is that if you do use Lua,
  291. then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation.
  292. For details, see
  293. <A HREF="http://www.lua.org/license.html">this</A>.
  294. <BLOCKQUOTE STYLE="padding-bottom: 0em">
  295. Copyright &copy; 1994&ndash;2017 Lua.org, PUC-Rio.
  296. <P>
  297. Permission is hereby granted, free of charge, to any person obtaining a copy
  298. of this software and associated documentation files (the "Software"), to deal
  299. in the Software without restriction, including without limitation the rights
  300. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  301. copies of the Software, and to permit persons to whom the Software is
  302. furnished to do so, subject to the following conditions:
  303. <P>
  304. The above copyright notice and this permission notice shall be included in
  305. all copies or substantial portions of the Software.
  306. <P>
  307. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  308. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  309. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  310. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  311. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  312. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  313. THE SOFTWARE.
  314. </BLOCKQUOTE>
  315. <P>
  316. <P CLASS="footer">
  317. Last update:
  318. Mon Jun 18 22:57:33 -03 2018
  319. </P>
  320. <!--
  321. Last change: revised for Lua 5.3.5
  322. -->
  323. </BODY>
  324. </HTML>