readme.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Lua 5.5 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="https://www.lua.org/"><IMG SRC="logo.gif" ALT="Lua"></A>
  28. Welcome to Lua 5.5
  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="https://www.lua.org/authors.html">team</A>
  46. at
  47. <A HREF="https://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="https://www.lua.org/uses.html">many products and projects</A>
  53. around the world.
  54. <P>
  55. Lua's
  56. <A HREF="https://www.lua.org/">official website</A>
  57. provides complete information
  58. about Lua,
  59. including
  60. an
  61. <A HREF="https://www.lua.org/about.html">executive summary</A>,
  62. tips on
  63. <A HREF="https://www.lua.org/start.html">getting started</A>,
  64. and
  65. updated
  66. <A HREF="https://www.lua.org/docs.html">documentation</A>,
  67. especially the
  68. <A HREF="https://www.lua.org/manual/5.5/">reference manual</A>,
  69. which may differ slightly from the
  70. <A HREF="contents.html">local copy</A>
  71. distributed in this package.
  72. <H2><A NAME="install">Installing Lua</A></H2>
  73. <P>
  74. Lua is distributed in
  75. <A HREF="https://www.lua.org/ftp/">source</A>
  76. form.
  77. You need to build it before using it.
  78. Building Lua should be straightforward
  79. because
  80. Lua is implemented in pure ANSI C and compiles unmodified in all known
  81. platforms that have an ANSI C compiler.
  82. Lua also compiles unmodified as C++.
  83. The instructions given below for building Lua are for Unix-like platforms,
  84. such as Linux and macOS.
  85. See also
  86. <A HREF="#other">instructions for other systems</A>
  87. and
  88. <A HREF="#customization">customization options</A>.
  89. <P>
  90. If you don't have the time or the inclination to compile Lua yourself,
  91. get a binary from
  92. <A HREF="https://luabinaries.sourceforge.net">LuaBinaries</A>.
  93. <H3>Building Lua</H3>
  94. <P>
  95. In most common Unix-like platforms, simply do "<KBD>make</KBD>".
  96. Here are the details.
  97. <OL>
  98. <LI>
  99. Open a terminal window and move to
  100. the top-level directory, which is named <TT>lua-5.5.0</TT>.
  101. The <TT>Makefile</TT> there controls both the build process and the installation process.
  102. <P>
  103. <LI>
  104. Do "<KBD>make</KBD>". The <TT>Makefile</TT> will guess your platform and build Lua for it.
  105. <P>
  106. <LI>
  107. If the guess failed, do "<KBD>make help</KBD>" and see if your platform is listed.
  108. The platforms currently supported are:
  109. <P>
  110. <P CLASS="display">
  111. guess aix bsd c89 freebsd generic ios linux macosx mingw posix solaris
  112. </P>
  113. <P>
  114. If your platform is listed, just do "<KBD>make xxx</KBD>", where xxx
  115. is your platform name.
  116. <P>
  117. If your platform is not listed, try the closest one or posix, generic,
  118. c89, in this order.
  119. <P>
  120. <LI>
  121. The compilation takes only a few moments
  122. and produces three files in the <TT>src</TT> directory:
  123. lua (the interpreter),
  124. luac (the compiler),
  125. and liblua.a (the library).
  126. <P>
  127. <LI>
  128. To check that Lua has been built correctly, do "<KBD>make test</KBD>"
  129. after building Lua. This will run the interpreter and print its version.
  130. </OL>
  131. <P>
  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, and so may need to do "<KBD>sudo make install</KBD>".
  138. <P>
  139. To build and install Lua in one step, do "<KBD>make all install</KBD>",
  140. or "<KBD>make xxx install</KBD>",
  141. where xxx is your platform name.
  142. <P>
  143. To install Lua locally after building it, do "<KBD>make local</KBD>".
  144. This will create a directory <TT>install</TT> with subdirectories
  145. <TT>bin</TT>, <TT>include</TT>, <TT>lib</TT>, <TT>man</TT>, <TT>share</TT>,
  146. and install Lua as listed below.
  147. To install Lua locally, but in some other directory, do
  148. "<KBD>make install INSTALL_TOP=xxx</KBD>", where xxx is your chosen directory.
  149. The installation starts in the <TT>src</TT> and <TT>doc</TT> directories,
  150. so take care if <TT>INSTALL_TOP</TT> is not an absolute path.
  151. <DL CLASS="display">
  152. <DT>
  153. bin:
  154. <DD>
  155. lua luac
  156. <DT>
  157. include:
  158. <DD>
  159. lua.h luaconf.h lualib.h lauxlib.h lua.hpp
  160. <DT>
  161. lib:
  162. <DD>
  163. liblua.a
  164. <DT>
  165. man/man1:
  166. <DD>
  167. lua.1 luac.1
  168. </DL>
  169. <P>
  170. These are the only directories you need for development.
  171. If you only want to run Lua programs,
  172. you only need the files in <TT>bin</TT> and <TT>man</TT>.
  173. The files in <TT>include</TT> and <TT>lib</TT> are needed for
  174. embedding Lua in C or C++ programs.
  175. <H3><A NAME="customization">Customization</A></H3>
  176. <P>
  177. Three kinds of things can be customized by editing a file:
  178. <UL>
  179. <LI> Where and how to install Lua &mdash; edit <TT>Makefile</TT>.
  180. <LI> How to build Lua &mdash; edit <TT>src/Makefile</TT>.
  181. <LI> Lua features &mdash; edit <TT>src/luaconf.h</TT>.
  182. </UL>
  183. <P>
  184. You don't actually need to edit the Makefiles because you may set the
  185. relevant variables in the command line when invoking make.
  186. Nevertheless, it's probably best to edit and save the Makefiles to
  187. record the changes you've made.
  188. <P>
  189. On the other hand, if you need to customize some Lua features,
  190. edit <TT>src/luaconf.h</TT> before building and installing Lua.
  191. The edited file will be the one installed, and
  192. it will be used by any Lua clients that you build, to ensure consistency.
  193. Further customization is available to experts by editing the Lua sources.
  194. <H3><A NAME="other">Building Lua on other systems</A></H3>
  195. <P>
  196. If you're not using the usual Unix tools, then the instructions for
  197. building Lua depend on the compiler you use. You'll need to create
  198. projects (or whatever your compiler uses) for building the library,
  199. the interpreter, and the compiler, as follows:
  200. <DL CLASS="display">
  201. <DT>
  202. library:
  203. <DD>
  204. 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
  205. lauxlib.c lbaselib.c lcorolib.c ldblib.c liolib.c lmathlib.c loadlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c linit.c
  206. <DT>
  207. interpreter:
  208. <DD>
  209. library, lua.c
  210. <DT>
  211. compiler:
  212. <DD>
  213. library, luac.c
  214. </DL>
  215. <P>
  216. To use Lua as a library in your own programs, you need to know how to
  217. create and use libraries with your compiler. Moreover, to dynamically load
  218. C libraries for Lua, you'll need to know how to create dynamic libraries
  219. and you'll need to make sure that the Lua API functions are accessible to
  220. those dynamic libraries &mdash; but <EM>don't</EM> link the Lua library
  221. into each dynamic library. For Unix, we recommend that the Lua library
  222. be linked statically into the host program and its symbols exported for
  223. dynamic linking; <TT>src/Makefile</TT> does this for the Lua interpreter.
  224. For Windows, we recommend that the Lua library be a DLL.
  225. In all cases, the compiler luac should be linked statically.
  226. <P>
  227. As mentioned above, you may edit <TT>src/luaconf.h</TT> to customize
  228. some features before building Lua.
  229. <H2><A NAME="changes">Changes since Lua 5.4</A></H2>
  230. <P>
  231. Here are the main changes introduced in Lua 5.5.
  232. The
  233. <A HREF="contents.html">reference manual</A>
  234. lists the
  235. <A HREF="manual.html#8">incompatibilities</A> that had to be introduced.
  236. <H3>Main changes</H3>
  237. <UL>
  238. <LI> declarations for global variables
  239. <LI> for-loop variables are read only
  240. <LI> floats are printed in decimal with enough digits to be read back correctly.
  241. <LI> more levels for constructors
  242. <LI> table.create
  243. <LI> utf8.offset returns also final position of character
  244. <LI> external strings (that use memory not managed by Lua)
  245. <LI> new functions luaL_openselectedlibs and luaL_makeseed
  246. <LI> major collections done incrementally
  247. <LI> more compact arrays (large arrays use about 60% less memory)
  248. <LI> lua.c loads 'readline' dynamically
  249. <LI> static (fixed) binaries (when loading a binary chunk in memory, Lua can reuse its original memory in some of the internal structures)
  250. <LI> dump and undump reuse all strings
  251. <LI> auxiliary buffer reuses buffer when it creates final string
  252. </UL>
  253. <H2><A NAME="license">License</A></H2>
  254. <P>
  255. <A HREF="https://opensource.org/osd">
  256. <IMG SRC="OSIApproved_100X125.png" ALIGN="right" ALT="[Open Source Initiative Approved License]" STYLE="padding-left: 1em" WIDTH=50>
  257. </A>
  258. Lua is free software distributed under the terms of the
  259. <A HREF="https://opensource.org/license/mit">MIT license</A>
  260. reproduced below;
  261. it may be used for any purpose, including commercial purposes,
  262. at absolutely no cost without having to ask us.
  263. The only requirement is that if you do use Lua,
  264. then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation.
  265. For details, see the
  266. <A HREF="https://www.lua.org/license.html">license page</A>.
  267. <BLOCKQUOTE STYLE="padding-bottom: 0em">
  268. Copyright &copy; 1994&ndash;2025 Lua.org, PUC-Rio.
  269. <P>
  270. Permission is hereby granted, free of charge, to any person obtaining a copy
  271. of this software and associated documentation files (the "Software"), to deal
  272. in the Software without restriction, including without limitation the rights
  273. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  274. copies of the Software, and to permit persons to whom the Software is
  275. furnished to do so, subject to the following conditions:
  276. <P>
  277. The above copyright notice and this permission notice shall be included in
  278. all copies or substantial portions of the Software.
  279. <P>
  280. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  281. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  282. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  283. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  284. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  285. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  286. THE SOFTWARE.
  287. </BLOCKQUOTE>
  288. <P>
  289. <P CLASS="footer">
  290. Last update:
  291. Thu Jun 26 13:06:11 UTC 2025
  292. </P>
  293. <!--
  294. Last change: revised for Lua 5.5.0
  295. -->
  296. </BODY>
  297. </HTML>