readme.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Lua 5.4 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.4
  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, efficient, 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
  52. <A HREF="http://www.lua.org/uses.html">many products and projects</A>
  53. around the world.
  54. <P>
  55. Lua's
  56. <A HREF="http://www.lua.org/">official web site</A>
  57. provides complete information
  58. about Lua,
  59. including
  60. an
  61. <A HREF="http://www.lua.org/about.html">executive summary</A>
  62. and
  63. updated
  64. <A HREF="http://www.lua.org/docs.html">documentation</A>,
  65. especially the
  66. <A HREF="http://www.lua.org/manual/5.4/">reference manual</A>,
  67. which may differ slightly from the
  68. <A HREF="contents.html">local copy</A>
  69. distributed in this package.
  70. <H2><A NAME="install">Installing Lua</A></H2>
  71. <P>
  72. Lua is distributed in
  73. <A HREF="http://www.lua.org/ftp/">source</A>
  74. form.
  75. You need to build it before using it.
  76. Building Lua should be straightforward
  77. because
  78. Lua is implemented in pure ANSI C and compiles unmodified in all known
  79. platforms that have an ANSI C compiler.
  80. Lua also compiles unmodified as C++.
  81. The instructions given below for building Lua are for Unix-like platforms,
  82. such as Linux and Mac OS X.
  83. See also
  84. <A HREF="#other">instructions for other systems</A>
  85. and
  86. <A HREF="#customization">customization options</A>.
  87. <P>
  88. If you don't have the time or the inclination to compile Lua yourself,
  89. get a binary from
  90. <A HREF="http://lua-users.org/wiki/LuaBinaries">LuaBinaries</A>.
  91. Try also
  92. <A HREF="http://luadist.org/">LuaDist</A>,
  93. a multi-platform distribution of Lua that includes batteries.
  94. <H3>Building Lua</H3>
  95. <P>
  96. In most Unix-like platforms, simply do "<KBD>make</KBD>" with a suitable target.
  97. Here are the details.
  98. <OL>
  99. <LI>
  100. Open a terminal window and move to
  101. the top-level directory, which is named <TT>lua-5.4.0-beta</TT>.
  102. The <TT>Makefile</TT> there controls both the build process and the installation process.
  103. <P>
  104. <LI>
  105. Do "<KBD>make</KBD>" and see if your platform is listed.
  106. The platforms currently supported are:
  107. <P>
  108. <P CLASS="display">
  109. aix bsd c89 freebsd generic guess linux linux-readline macosx mingw posix solaris
  110. </P>
  111. <P>
  112. If your platform is a common Unix-like platform,
  113. just do "<KBD>make guess</KBD>".
  114. The <TT>Makefile</TT> will guess your platform and build Lua for it.
  115. <P>
  116. If your platform is listed, just do "<KBD>make xxx</KBD>", where xxx
  117. is your platform name.
  118. <P>
  119. If your platform is not listed, try the closest one or posix, generic,
  120. c89, in this order.
  121. <P>
  122. <LI>
  123. The compilation takes only a few moments
  124. and produces three files in the <TT>src</TT> directory:
  125. lua (the interpreter),
  126. luac (the compiler),
  127. and liblua.a (the library).
  128. <P>
  129. <LI>
  130. To check that Lua has been built correctly, do "<KBD>make test</KBD>"
  131. after building Lua. This will run the interpreter and print its version.
  132. </OL>
  133. <P>
  134. If you're running Linux and get compilation errors when building for <TT>linux-readline</TT>,
  135. make sure you have installed the <TT>readline</TT> development package
  136. (which is probably named <TT>libreadline-dev</TT> or <TT>readline-devel</TT>).
  137. If you get link errors after that,
  138. then try "<KBD>make linux MYLIBS=-ltermcap</KBD>".
  139. <H3>Installing Lua</H3>
  140. <P>
  141. Once you have built Lua, you may want to install it in an official
  142. place in your system. In this case, do "<KBD>make install</KBD>". The official
  143. place and the way to install files are defined in the <TT>Makefile</TT>. You'll
  144. probably need the right permissions to install files, and so may need to do "<KBD>sudo make install</KBD>".
  145. <P>
  146. To build and install Lua in one step, do "<KBD>make xxx install</KBD>",
  147. where xxx is your platform name, including "guess".
  148. <P>
  149. To install Lua locally, do "<KBD>make local</KBD>".
  150. This will create a directory <TT>install</TT> with subdirectories
  151. <TT>bin</TT>, <TT>include</TT>, <TT>lib</TT>, <TT>man</TT>, <TT>share</TT>,
  152. and install Lua as listed below.
  153. To install Lua locally, but in some other directory, do
  154. "<KBD>make install INSTALL_TOP=xxx</KBD>", where xxx is your chosen directory.
  155. The installation starts in the <TT>src</TT> and <TT>doc</TT> directories,
  156. so take care if <TT>INSTALL_TOP</TT> is not an absolute path.
  157. <DL CLASS="display">
  158. <DT>
  159. bin:
  160. <DD>
  161. lua luac
  162. <DT>
  163. include:
  164. <DD>
  165. lua.h luaconf.h lualib.h lauxlib.h lua.hpp
  166. <DT>
  167. lib:
  168. <DD>
  169. liblua.a
  170. <DT>
  171. man/man1:
  172. <DD>
  173. lua.1 luac.1
  174. </DL>
  175. <P>
  176. These are the only directories you need for development.
  177. If you only want to run Lua programs,
  178. you only need the files in <TT>bin</TT> and <TT>man</TT>.
  179. The files in <TT>include</TT> and <TT>lib</TT> are needed for
  180. embedding Lua in C or C++ programs.
  181. <H3><A NAME="customization">Customization</A></H3>
  182. <P>
  183. Three kinds of things can be customized by editing a file:
  184. <UL>
  185. <LI> Where and how to install Lua &mdash; edit <TT>Makefile</TT>.
  186. <LI> How to build Lua &mdash; edit <TT>src/Makefile</TT>.
  187. <LI> Lua features &mdash; edit <TT>src/luaconf.h</TT>.
  188. </UL>
  189. <P>
  190. You don't actually need to edit the Makefiles because you may set the
  191. relevant variables in the command line when invoking make.
  192. Nevertheless, it's probably best to edit and save the Makefiles to
  193. record the changes you've made.
  194. <P>
  195. On the other hand, if you need to customize some Lua features, you'll need
  196. to edit <TT>src/luaconf.h</TT> before building and installing Lua.
  197. The edited file will be the one installed, and
  198. it will be used by any Lua clients that you build, to ensure consistency.
  199. Further customization is available to experts by editing the Lua sources.
  200. <H3><A NAME="other">Building Lua on other systems</A></H3>
  201. <P>
  202. If you're not using the usual Unix tools, then the instructions for
  203. building Lua depend on the compiler you use. You'll need to create
  204. projects (or whatever your compiler uses) for building the library,
  205. the interpreter, and the compiler, as follows:
  206. <DL CLASS="display">
  207. <DT>
  208. library:
  209. <DD>
  210. lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c
  211. lauxlib.c lbaselib.c lcorolib.c ldblib.c liolib.c lmathlib.c loadlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c linit.c
  212. <DT>
  213. interpreter:
  214. <DD>
  215. library, lua.c
  216. <DT>
  217. compiler:
  218. <DD>
  219. library, luac.c
  220. </DL>
  221. <P>
  222. To use Lua as a library in your own programs, you'll need to know how to
  223. create and use libraries with your compiler. Moreover, to dynamically load
  224. C libraries for Lua, you'll need to know how to create dynamic libraries
  225. and you'll need to make sure that the Lua API functions are accessible to
  226. those dynamic libraries &mdash; but <EM>don't</EM> link the Lua library
  227. into each dynamic library. For Unix, we recommend that the Lua library
  228. be linked statically into the host program and its symbols exported for
  229. dynamic linking; <TT>src/Makefile</TT> does this for the Lua interpreter.
  230. For Windows, we recommend that the Lua library be a DLL.
  231. In all cases, the compiler luac should be linked statically.
  232. <P>
  233. As mentioned above, you may edit <TT>src/luaconf.h</TT> to customize
  234. some features before building Lua.
  235. <H2><A NAME="changes">Changes since Lua 5.3</A></H2>
  236. <P>
  237. Here are the main changes introduced in Lua 5.4.
  238. The
  239. <A HREF="contents.html">reference manual</A>
  240. lists the
  241. <A HREF="manual.html#8">incompatibilities</A> that had to be introduced.
  242. <H3>Main changes</H3>
  243. <UL>
  244. <LI> new generational mode for garbage collection
  245. <LI> to-be-closed variables
  246. <LI> const variables
  247. <LI> userdata can have multiple user values
  248. <LI> new implementation for math.random
  249. <LI> warning system
  250. <LI> debug information about function arguments and returns
  251. <LI> new semantics for the integer 'for' loop
  252. <LI> optional 'init' argument to 'string.gmatch'
  253. <LI> new functions 'lua_resetthread' and 'coroutine.close'
  254. <LI> string-to-number coercions moved to the string library
  255. <LI> allocation function allowed to fail when shrinking a memory block
  256. <LI> new format '%p' in 'string.format'
  257. <LI> utf8 library accepts codepoints up to 2^31
  258. </UL>
  259. <H2><A NAME="license">License</A></H2>
  260. <P>
  261. <A HREF="http://www.opensource.org/docs/definition.php">
  262. <IMG SRC="osi-certified-72x60.png" ALIGN="right" ALT="[osi certified]" STYLE="padding-left: 30px ;">
  263. </A>
  264. Lua is free software distributed under the terms of the
  265. <A HREF="http://www.opensource.org/licenses/mit-license.html">MIT license</A>
  266. reproduced below;
  267. it may be used for any purpose, including commercial purposes,
  268. at absolutely no cost without having to ask us.
  269. The only requirement is that if you do use Lua,
  270. then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation.
  271. For details, see
  272. <A HREF="http://www.lua.org/license.html">this</A>.
  273. <BLOCKQUOTE STYLE="padding-bottom: 0em">
  274. Copyright &copy; 1994&ndash;2019 Lua.org, PUC-Rio.
  275. <P>
  276. Permission is hereby granted, free of charge, to any person obtaining a copy
  277. of this software and associated documentation files (the "Software"), to deal
  278. in the Software without restriction, including without limitation the rights
  279. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  280. copies of the Software, and to permit persons to whom the Software is
  281. furnished to do so, subject to the following conditions:
  282. <P>
  283. The above copyright notice and this permission notice shall be included in
  284. all copies or substantial portions of the Software.
  285. <P>
  286. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  287. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  288. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  289. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  290. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  291. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  292. THE SOFTWARE.
  293. </BLOCKQUOTE>
  294. <P>
  295. <P CLASS="footer">
  296. Last update:
  297. Thu Oct 3 12:42:49 UTC 2019
  298. </P>
  299. <!--
  300. Last change: revised for Lua 5.4.0 (beta)
  301. -->
  302. </BODY>
  303. </HTML>