History

Lua 5.1.3-rc1

Lua Team committed 18 years ago

Commit ea97e791 parent 4d388a360 files · +732 −439Browse files

Unified · Split

60 files
  1. Makefile +7 −13
  2. doc/contents.html +55 −15
  3. doc/manual.css +6 −0
  4. doc/manual.html +513 −285
  5. doc/readme.html +2 −2
  6. etc/lua.pc +1 −1
  7. src/Makefile +1 −2
  8. src/lapi.c +7 −2
  9. src/lapi.h +1 −1
  10. src/lauxlib.c +2 −2
  11. src/lauxlib.h +1 −1
  12. src/lbaselib.c +41 −32
  13. src/lcode.c +2 −2
  14. src/lcode.h +1 −1
  15. src/ldblib.c +1 −1
  16. src/ldebug.c +3 −3
  17. src/ldebug.h +1 −1
  18. src/ldo.c +12 −10
  19. src/ldo.h +1 −1
  20. src/ldump.c +1 −1
  21. src/lfunc.c +1 −1
  22. src/lfunc.h +1 −1
  23. src/lgc.c +1 −1
  24. src/lgc.h +1 −1
  25. src/linit.c +1 −1
  26. src/liolib.c +7 −5
  27. src/llex.c +1 −1
  28. src/llex.h +1 −1
  29. src/llimits.h +1 −1
  30. src/lmathlib.c +1 −1
  31. src/lmem.c +1 −1
  32. src/lmem.h +1 −1
  33. src/loadlib.c +1 −1
  34. src/lobject.c +1 −1
  35. src/lobject.h +1 −1
  36. src/lopcodes.c +1 −1
  37. src/lopcodes.h +1 −1
  38. src/loslib.c +1 −1
  39. src/lparser.c +3 −1
  40. src/lparser.h +1 −1
  41. src/lstate.c +3 −3
  42. src/lstate.h +2 −1
  43. src/lstring.c +1 −1
  44. src/lstring.h +1 −1
  45. src/lstrlib.c +5 −5
  46. src/ltable.c +3 −3
  47. src/ltable.h +1 −1
  48. src/ltablib.c +3 −2
  49. src/ltm.c +1 −1
  50. src/ltm.h +1 −1
  51. src/lua.c +4 −2
  52. src/lua.h +7 −4
  53. src/luaconf.h +3 −2
  54. src/lualib.h +1 −1
  55. src/lundump.c +1 −1
  56. src/lundump.h +1 −1
  57. src/lvm.c +4 −6
  58. src/lvm.h +1 −1
  59. src/lzio.c +1 −1
  60. src/lzio.h +1 −1
Makefile+7−13
@@ -20,20 +20,15 @@ INSTALL_MAN= $(INSTALL_TOP)/man/man1 · 19 unmodified lines
20INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V20INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
21INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V21INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
22 22
23# How to install. You may prefer "install" instead of "cp" if you have it.23# How to install. If you don't have "install" (unlikely) then get install-sh at
24# To remove debug information from binaries, use "install -s" in INSTALL_EXEC.24# http://dev.w3.org/cvsweb/libwww/config/install-sh
25#25# or use cp instead.
26INSTALL_EXEC= $(CP)26INSTALL_EXEC= $(INSTALL) -p -m 0755
27INSTALL_DATA= $(CP)27INSTALL_DATA= $(INSTALL) -p -m 0644
28#INSTALL_EXEC= $(INSTALL) -m 0755
29#INSTALL_DATA= $(INSTALL) -m 0644
30 28
31# Utilities.29# Utilities.
32CP= cp
33FIND= find
34INSTALL= install30INSTALL= install
35MKDIR= mkdir31MKDIR= mkdir
36RANLIB= ranlib
37 32
38# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========33# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
39 34
@@ -48,7 +43,7 @@ TO_MAN= lua.1 luac.1 · 8 unmodified lines
48 43
49# Lua version and release.44# Lua version and release.
50V= 5.145V= 5.1
51R= 5.1.246R= 5.1.3
52 47
53all: $(PLAT)48all: $(PLAT)
54 49
@@ -64,10 +59,9 @@ install: dummy · 9 unmodified lines
64 cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)59 cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
65 cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)60 cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
66 cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)61 cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
67# $(RANLIB) $(INSTALL_LIB)/$(TO_LIB)
68 62
69local:63local:
70 $(MAKE) install INSTALL_TOP=.. INSTALL_EXEC="cp -p" INSTALL_DATA="cp -p"64 $(MAKE) install INSTALL_TOP=..
71 65
72none:66none:
73 @echo "Please do"67 @echo "Please do"
doc/contents.html+55−15
@@ -1,6 +1,6 @@
1<HTML>1<HTML>
2<HEAD>2<HEAD>
3<TITLE>Lua 5.1 reference manual - contents</TITLE>3<TITLE>Lua 5.1 Reference Manual - contents</TITLE>
4<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">4<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
5<STYLE TYPE="text/css">5<STYLE TYPE="text/css">
6ul {6ul {
@@ -33,21 +33,28 @@ This is an online version of · 26 unmodified lines
33</BLOCKQUOTE>33</BLOCKQUOTE>
34<P>34<P>
35 35
36Buy a paper copy and 36Buy a copy of this book and
37<A HREF="http://www.lua.org/donations.html">help to support</A>37<A HREF="http://www.lua.org/donations.html">help to support</A>
38the Lua project.38the Lua project.
39<P>39<P>
40 40
41The reference manual is the official definition of the Lua language.
42For a complete introduction to Lua programming, see the book
43<A HREF="http://www.lua.org/docs.html#books">Programming in Lua</A>.
44<P>
45
41<A HREF="manual.html">start</A>46<A HREF="manual.html">start</A>
42&middot;47&middot;
43<A HREF="#contents">contents</A>48<A HREF="#contents">contents</A>
44&middot;49&middot;
45<A HREF="#index">index</A>50<A HREF="#index">index</A>
46&middot;51&middot;
47<A HREF="http://www.lua.org/manual/5.1/errata.html">errata</A>52<A HREF="http://www.lua.org/manual/5.1/pt/">portugu&ecirc;s</A>
53&middot;
54<A HREF="http://www.lua.org/manual/5.1/es/">espa&ntilde;ol</A>
48<HR>55<HR>
49<SMALL>56<SMALL>
50Copyright &copy; 2006-2007 Lua.org, PUC-Rio.57Copyright &copy; 2006-2008 Lua.org, PUC-Rio.
51Freely available under the terms of the58Freely available under the terms of the
52<a href="http://www.lua.org/license.html#5">Lua license</a>.59<a href="http://www.lua.org/license.html#5">Lua license</a>.
53</SMALL>60</SMALL>
@@ -55,7 +62,8 @@ Freely available under the terms of the · 1 unmodified line
55 62
56<H2><A NAME="contents">Contents</A></H2>63<H2><A NAME="contents">Contents</A></H2>
57<UL style="padding: 0">64<UL style="padding: 0">
58<LI><A HREF="manual.html#1">1 - Introduction</A>65<LI><A HREF="manual.html">1 - Introduction</A>
66<P>
59<LI><A HREF="manual.html#2">2 - The Language</A>67<LI><A HREF="manual.html#2">2 - The Language</A>
60<UL>68<UL>
61<LI><A HREF="manual.html#2.1">2.1 - Lexical Conventions</A>69<LI><A HREF="manual.html#2.1">2.1 - Lexical Conventions</A>
@@ -97,6 +105,7 @@ Freely available under the terms of the · 35 unmodified lines
97</UL>105</UL>
98<LI><A HREF="manual.html#2.11">2.11 - Coroutines</A>106<LI><A HREF="manual.html#2.11">2.11 - Coroutines</A>
99</UL>107</UL>
108<P>
100<LI><A HREF="manual.html#3">3 - The Application Program Interface</A>109<LI><A HREF="manual.html#3">3 - The Application Program Interface</A>
101<UL>110<UL>
102<LI><A HREF="manual.html#3.1">3.1 - The Stack</A>111<LI><A HREF="manual.html#3.1">3.1 - The Stack</A>
@@ -108,10 +117,12 @@ Freely available under the terms of the · 5 unmodified lines
108<LI><A HREF="manual.html#3.7">3.7 - Functions and Types</A>117<LI><A HREF="manual.html#3.7">3.7 - Functions and Types</A>
109<LI><A HREF="manual.html#3.8">3.8 - The Debug Interface</A>118<LI><A HREF="manual.html#3.8">3.8 - The Debug Interface</A>
110</UL>119</UL>
120<P>
111<LI><A HREF="manual.html#4">4 - The Auxiliary Library</A>121<LI><A HREF="manual.html#4">4 - The Auxiliary Library</A>
112<UL>122<UL>
113<LI><A HREF="manual.html#4.1">4.1 - Functions and Types</A>123<LI><A HREF="manual.html#4.1">4.1 - Functions and Types</A>
114</UL>124</UL>
125<P>
115<LI><A HREF="manual.html#5">5 - Standard Libraries</A>126<LI><A HREF="manual.html#5">5 - Standard Libraries</A>
116<UL>127<UL>
117<LI><A HREF="manual.html#5.1">5.1 - Basic Functions</A>128<LI><A HREF="manual.html#5.1">5.1 - Basic Functions</A>
@@ -127,13 +138,16 @@ Freely available under the terms of the · 9 unmodified lines
127<LI><A HREF="manual.html#5.8">5.8 - Operating System Facilities</A>138<LI><A HREF="manual.html#5.8">5.8 - Operating System Facilities</A>
128<LI><A HREF="manual.html#5.9">5.9 - The Debug Library</A>139<LI><A HREF="manual.html#5.9">5.9 - The Debug Library</A>
129</UL>140</UL>
141<P>
130<LI><A HREF="manual.html#6">6 - Lua Stand-alone</A>142<LI><A HREF="manual.html#6">6 - Lua Stand-alone</A>
143<P>
131<LI><A HREF="manual.html#7">7 - Incompatibilities with the Previous Version</A>144<LI><A HREF="manual.html#7">7 - Incompatibilities with the Previous Version</A>
132<UL>145<UL>
133<LI><A HREF="manual.html#7.1">7.1 - Changes in the Language</A>146<LI><A HREF="manual.html#7.1">7.1 - Changes in the Language</A>
134<LI><A HREF="manual.html#7.2">7.2 - Changes in the Libraries</A>147<LI><A HREF="manual.html#7.2">7.2 - Changes in the Libraries</A>
135<LI><A HREF="manual.html#7.3">7.3 - Changes in the API</A>148<LI><A HREF="manual.html#7.3">7.3 - Changes in the API</A>
136</UL>149</UL>
150<P>
137<LI><A HREF="manual.html#8">8 - The Complete Syntax of Lua</A>151<LI><A HREF="manual.html#8">8 - The Complete Syntax of Lua</A>
138</UL>152</UL>
139 153
@@ -171,16 +185,16 @@ Freely available under the terms of the · 31 unmodified lines
171<A HREF="manual.html#pdf-type">type</A><BR>185<A HREF="manual.html#pdf-type">type</A><BR>
172<A HREF="manual.html#pdf-unpack">unpack</A><BR>186<A HREF="manual.html#pdf-unpack">unpack</A><BR>
173<A HREF="manual.html#pdf-xpcall">xpcall</A><BR>187<A HREF="manual.html#pdf-xpcall">xpcall</A><BR>
188<P>
174 189
175</TD>
176<TD>
177<H3>&nbsp;</H3>
178<A HREF="manual.html#pdf-coroutine.create">coroutine.create</A><BR>190<A HREF="manual.html#pdf-coroutine.create">coroutine.create</A><BR>
179<A HREF="manual.html#pdf-coroutine.resume">coroutine.resume</A><BR>191<A HREF="manual.html#pdf-coroutine.resume">coroutine.resume</A><BR>
180<A HREF="manual.html#pdf-coroutine.running">coroutine.running</A><BR>192<A HREF="manual.html#pdf-coroutine.running">coroutine.running</A><BR>
181<A HREF="manual.html#pdf-coroutine.status">coroutine.status</A><BR>193<A HREF="manual.html#pdf-coroutine.status">coroutine.status</A><BR>
182<A HREF="manual.html#pdf-coroutine.wrap">coroutine.wrap</A><BR>194<A HREF="manual.html#pdf-coroutine.wrap">coroutine.wrap</A><BR>
183<A HREF="manual.html#pdf-coroutine.yield">coroutine.yield</A><BR>195<A HREF="manual.html#pdf-coroutine.yield">coroutine.yield</A><BR>
196<P>
197
184<A HREF="manual.html#pdf-debug.debug">debug.debug</A><BR>198<A HREF="manual.html#pdf-debug.debug">debug.debug</A><BR>
185<A HREF="manual.html#pdf-debug.getfenv">debug.getfenv</A><BR>199<A HREF="manual.html#pdf-debug.getfenv">debug.getfenv</A><BR>
186<A HREF="manual.html#pdf-debug.gethook">debug.gethook</A><BR>200<A HREF="manual.html#pdf-debug.gethook">debug.gethook</A><BR>
@@ -195,6 +209,10 @@ Freely available under the terms of the · 8 unmodified lines
195<A HREF="manual.html#pdf-debug.setmetatable">debug.setmetatable</A><BR>209<A HREF="manual.html#pdf-debug.setmetatable">debug.setmetatable</A><BR>
196<A HREF="manual.html#pdf-debug.setupvalue">debug.setupvalue</A><BR>210<A HREF="manual.html#pdf-debug.setupvalue">debug.setupvalue</A><BR>
197<A HREF="manual.html#pdf-debug.traceback">debug.traceback</A><BR>211<A HREF="manual.html#pdf-debug.traceback">debug.traceback</A><BR>
212
213</TD>
214<TD>
215<H3>&nbsp;</H3>
198<A HREF="manual.html#pdf-file:close">file:close</A><BR>216<A HREF="manual.html#pdf-file:close">file:close</A><BR>
199<A HREF="manual.html#pdf-file:flush">file:flush</A><BR>217<A HREF="manual.html#pdf-file:flush">file:flush</A><BR>
200<A HREF="manual.html#pdf-file:lines">file:lines</A><BR>218<A HREF="manual.html#pdf-file:lines">file:lines</A><BR>
@@ -202,6 +220,8 @@ Freely available under the terms of the · 1 unmodified line
202<A HREF="manual.html#pdf-file:seek">file:seek</A><BR>220<A HREF="manual.html#pdf-file:seek">file:seek</A><BR>
203<A HREF="manual.html#pdf-file:setvbuf">file:setvbuf</A><BR>221<A HREF="manual.html#pdf-file:setvbuf">file:setvbuf</A><BR>
204<A HREF="manual.html#pdf-file:write">file:write</A><BR>222<A HREF="manual.html#pdf-file:write">file:write</A><BR>
223<P>
224
205<A HREF="manual.html#pdf-io.close">io.close</A><BR>225<A HREF="manual.html#pdf-io.close">io.close</A><BR>
206<A HREF="manual.html#pdf-io.flush">io.flush</A><BR>226<A HREF="manual.html#pdf-io.flush">io.flush</A><BR>
207<A HREF="manual.html#pdf-io.input">io.input</A><BR>227<A HREF="manual.html#pdf-io.input">io.input</A><BR>
@@ -210,17 +230,22 @@ Freely available under the terms of the · 2 unmodified lines
210<A HREF="manual.html#pdf-io.output">io.output</A><BR>230<A HREF="manual.html#pdf-io.output">io.output</A><BR>
211<A HREF="manual.html#pdf-io.popen">io.popen</A><BR>231<A HREF="manual.html#pdf-io.popen">io.popen</A><BR>
212<A HREF="manual.html#pdf-io.read">io.read</A><BR>232<A HREF="manual.html#pdf-io.read">io.read</A><BR>
233<A HREF="manual.html#pdf-io.stderr">io.stderr</A><BR>
234<A HREF="manual.html#pdf-io.stdin">io.stdin</A><BR>
235<A HREF="manual.html#pdf-io.stdout">io.stdout</A><BR>
213<A HREF="manual.html#pdf-io.tmpfile">io.tmpfile</A><BR>236<A HREF="manual.html#pdf-io.tmpfile">io.tmpfile</A><BR>
214<A HREF="manual.html#pdf-io.type">io.type</A><BR>237<A HREF="manual.html#pdf-io.type">io.type</A><BR>
215<A HREF="manual.html#pdf-io.write">io.write</A><BR>238<A HREF="manual.html#pdf-io.write">io.write</A><BR>
239<P>
240
216<A HREF="manual.html#pdf-math.abs">math.abs</A><BR>241<A HREF="manual.html#pdf-math.abs">math.abs</A><BR>
217<A HREF="manual.html#pdf-math.acos">math.acos</A><BR>242<A HREF="manual.html#pdf-math.acos">math.acos</A><BR>
218<A HREF="manual.html#pdf-math.asin">math.asin</A><BR>243<A HREF="manual.html#pdf-math.asin">math.asin</A><BR>
219<A HREF="manual.html#pdf-math.atan2">math.atan2</A><BR>
220<A HREF="manual.html#pdf-math.atan">math.atan</A><BR>244<A HREF="manual.html#pdf-math.atan">math.atan</A><BR>
245<A HREF="manual.html#pdf-math.atan2">math.atan2</A><BR>
221<A HREF="manual.html#pdf-math.ceil">math.ceil</A><BR>246<A HREF="manual.html#pdf-math.ceil">math.ceil</A><BR>
222<A HREF="manual.html#pdf-math.cosh">math.cosh</A><BR>
223<A HREF="manual.html#pdf-math.cos">math.cos</A><BR>247<A HREF="manual.html#pdf-math.cos">math.cos</A><BR>
248<A HREF="manual.html#pdf-math.cosh">math.cosh</A><BR>
224<A HREF="manual.html#pdf-math.deg">math.deg</A><BR>249<A HREF="manual.html#pdf-math.deg">math.deg</A><BR>
225<A HREF="manual.html#pdf-math.exp">math.exp</A><BR>250<A HREF="manual.html#pdf-math.exp">math.exp</A><BR>
226<A HREF="manual.html#pdf-math.floor">math.floor</A><BR>251<A HREF="manual.html#pdf-math.floor">math.floor</A><BR>
@@ -228,8 +253,8 @@ Freely available under the terms of the · 1 unmodified line
228<A HREF="manual.html#pdf-math.frexp">math.frexp</A><BR>253<A HREF="manual.html#pdf-math.frexp">math.frexp</A><BR>
229<A HREF="manual.html#pdf-math.huge">math.huge</A><BR>254<A HREF="manual.html#pdf-math.huge">math.huge</A><BR>
230<A HREF="manual.html#pdf-math.ldexp">math.ldexp</A><BR>255<A HREF="manual.html#pdf-math.ldexp">math.ldexp</A><BR>
231<A HREF="manual.html#pdf-math.log10">math.log10</A><BR>
232<A HREF="manual.html#pdf-math.log">math.log</A><BR>256<A HREF="manual.html#pdf-math.log">math.log</A><BR>
257<A HREF="manual.html#pdf-math.log10">math.log10</A><BR>
233<A HREF="manual.html#pdf-math.max">math.max</A><BR>258<A HREF="manual.html#pdf-math.max">math.max</A><BR>
234<A HREF="manual.html#pdf-math.min">math.min</A><BR>259<A HREF="manual.html#pdf-math.min">math.min</A><BR>
235<A HREF="manual.html#pdf-math.modf">math.modf</A><BR>260<A HREF="manual.html#pdf-math.modf">math.modf</A><BR>
@@ -238,11 +263,13 @@ Freely available under the terms of the · 2 unmodified lines
238<A HREF="manual.html#pdf-math.rad">math.rad</A><BR>263<A HREF="manual.html#pdf-math.rad">math.rad</A><BR>
239<A HREF="manual.html#pdf-math.random">math.random</A><BR>264<A HREF="manual.html#pdf-math.random">math.random</A><BR>
240<A HREF="manual.html#pdf-math.randomseed">math.randomseed</A><BR>265<A HREF="manual.html#pdf-math.randomseed">math.randomseed</A><BR>
241<A HREF="manual.html#pdf-math.sinh">math.sinh</A><BR>
242<A HREF="manual.html#pdf-math.sin">math.sin</A><BR>266<A HREF="manual.html#pdf-math.sin">math.sin</A><BR>
267<A HREF="manual.html#pdf-math.sinh">math.sinh</A><BR>
243<A HREF="manual.html#pdf-math.sqrt">math.sqrt</A><BR>268<A HREF="manual.html#pdf-math.sqrt">math.sqrt</A><BR>
244<A HREF="manual.html#pdf-math.tanh">math.tanh</A><BR>
245<A HREF="manual.html#pdf-math.tan">math.tan</A><BR>269<A HREF="manual.html#pdf-math.tan">math.tan</A><BR>
270<A HREF="manual.html#pdf-math.tanh">math.tanh</A><BR>
271<P>
272
246<A HREF="manual.html#pdf-os.clock">os.clock</A><BR>273<A HREF="manual.html#pdf-os.clock">os.clock</A><BR>
247<A HREF="manual.html#pdf-os.date">os.date</A><BR>274<A HREF="manual.html#pdf-os.date">os.date</A><BR>
248<A HREF="manual.html#pdf-os.difftime">os.difftime</A><BR>275<A HREF="manual.html#pdf-os.difftime">os.difftime</A><BR>
@@ -254,12 +281,17 @@ Freely available under the terms of the · 5 unmodified lines
254<A HREF="manual.html#pdf-os.setlocale">os.setlocale</A><BR>281<A HREF="manual.html#pdf-os.setlocale">os.setlocale</A><BR>
255<A HREF="manual.html#pdf-os.time">os.time</A><BR>282<A HREF="manual.html#pdf-os.time">os.time</A><BR>
256<A HREF="manual.html#pdf-os.tmpname">os.tmpname</A><BR>283<A HREF="manual.html#pdf-os.tmpname">os.tmpname</A><BR>
284<P>
285
257<A HREF="manual.html#pdf-package.cpath">package.cpath</A><BR>286<A HREF="manual.html#pdf-package.cpath">package.cpath</A><BR>
258<A HREF="manual.html#pdf-package.loaded">package.loaded</A><BR>287<A HREF="manual.html#pdf-package.loaded">package.loaded</A><BR>
288<A HREF="manual.html#pdf-package.loaders">package.loaders</A><BR>
259<A HREF="manual.html#pdf-package.loadlib">package.loadlib</A><BR>289<A HREF="manual.html#pdf-package.loadlib">package.loadlib</A><BR>
260<A HREF="manual.html#pdf-package.path">package.path</A><BR>290<A HREF="manual.html#pdf-package.path">package.path</A><BR>
261<A HREF="manual.html#pdf-package.preload">package.preload</A><BR>291<A HREF="manual.html#pdf-package.preload">package.preload</A><BR>
262<A HREF="manual.html#pdf-package.seeall">package.seeall</A><BR>292<A HREF="manual.html#pdf-package.seeall">package.seeall</A><BR>
293<P>
294
263<A HREF="manual.html#pdf-string.byte">string.byte</A><BR>295<A HREF="manual.html#pdf-string.byte">string.byte</A><BR>
264<A HREF="manual.html#pdf-string.char">string.char</A><BR>296<A HREF="manual.html#pdf-string.char">string.char</A><BR>
265<A HREF="manual.html#pdf-string.dump">string.dump</A><BR>297<A HREF="manual.html#pdf-string.dump">string.dump</A><BR>
@@ -274,6 +306,8 @@ Freely available under the terms of the · 8 unmodified lines
274<A HREF="manual.html#pdf-string.reverse">string.reverse</A><BR>306<A HREF="manual.html#pdf-string.reverse">string.reverse</A><BR>
275<A HREF="manual.html#pdf-string.sub">string.sub</A><BR>307<A HREF="manual.html#pdf-string.sub">string.sub</A><BR>
276<A HREF="manual.html#pdf-string.upper">string.upper</A><BR>308<A HREF="manual.html#pdf-string.upper">string.upper</A><BR>
309<P>
310
277<A HREF="manual.html#pdf-table.concat">table.concat</A><BR>311<A HREF="manual.html#pdf-table.concat">table.concat</A><BR>
278<A HREF="manual.html#pdf-table.insert">table.insert</A><BR>312<A HREF="manual.html#pdf-table.insert">table.insert</A><BR>
279<A HREF="manual.html#pdf-table.maxn">table.maxn</A><BR>313<A HREF="manual.html#pdf-table.maxn">table.maxn</A><BR>
@@ -292,6 +326,8 @@ Freely available under the terms of the · 12 unmodified lines
292<A HREF="manual.html#lua_Reader">lua_Reader</A><BR>326<A HREF="manual.html#lua_Reader">lua_Reader</A><BR>
293<A HREF="manual.html#lua_State">lua_State</A><BR>327<A HREF="manual.html#lua_State">lua_State</A><BR>
294<A HREF="manual.html#lua_Writer">lua_Writer</A><BR>328<A HREF="manual.html#lua_Writer">lua_Writer</A><BR>
329<P>
330
295<A HREF="manual.html#lua_atpanic">lua_atpanic</A><BR>331<A HREF="manual.html#lua_atpanic">lua_atpanic</A><BR>
296<A HREF="manual.html#lua_call">lua_call</A><BR>332<A HREF="manual.html#lua_call">lua_call</A><BR>
297<A HREF="manual.html#lua_checkstack">lua_checkstack</A><BR>333<A HREF="manual.html#lua_checkstack">lua_checkstack</A><BR>
@@ -323,6 +359,8 @@ Freely available under the terms of the · 25 unmodified lines
323<A HREF="manual.html#lua_isfunction">lua_isfunction</A><BR>359<A HREF="manual.html#lua_isfunction">lua_isfunction</A><BR>
324<A HREF="manual.html#lua_islightuserdata">lua_islightuserdata</A><BR>360<A HREF="manual.html#lua_islightuserdata">lua_islightuserdata</A><BR>
325<A HREF="manual.html#lua_isnil">lua_isnil</A><BR>361<A HREF="manual.html#lua_isnil">lua_isnil</A><BR>
362<A HREF="manual.html#lua_isnone">lua_isnone</A><BR>
363<A HREF="manual.html#lua_isnoneornil">lua_isnoneornil</A><BR>
326<A HREF="manual.html#lua_isnumber">lua_isnumber</A><BR>364<A HREF="manual.html#lua_isnumber">lua_isnumber</A><BR>
327<A HREF="manual.html#lua_isstring">lua_isstring</A><BR>365<A HREF="manual.html#lua_isstring">lua_isstring</A><BR>
328<A HREF="manual.html#lua_istable">lua_istable</A><BR>366<A HREF="manual.html#lua_istable">lua_istable</A><BR>
@@ -391,6 +429,8 @@ Freely available under the terms of the · 62 unmodified lines
391<H3>auxiliary library</H3>429<H3>auxiliary library</H3>
392<A HREF="manual.html#luaL_Buffer">luaL_Buffer</A><BR>430<A HREF="manual.html#luaL_Buffer">luaL_Buffer</A><BR>
393<A HREF="manual.html#luaL_Reg">luaL_Reg</A><BR>431<A HREF="manual.html#luaL_Reg">luaL_Reg</A><BR>
432<P>
433
394<A HREF="manual.html#luaL_addchar">luaL_addchar</A><BR>434<A HREF="manual.html#luaL_addchar">luaL_addchar</A><BR>
395<A HREF="manual.html#luaL_addlstring">luaL_addlstring</A><BR>435<A HREF="manual.html#luaL_addlstring">luaL_addlstring</A><BR>
396<A HREF="manual.html#luaL_addsize">luaL_addsize</A><BR>436<A HREF="manual.html#luaL_addsize">luaL_addsize</A><BR>
@@ -446,10 +486,10 @@ Freely available under the terms of the · 49 unmodified lines
446<HR>486<HR>
447<SMALL>487<SMALL>
448Last update:488Last update:
449Fri Mar 23 08:33:19 BRT 2007489Thu Jan 17 14:50:23 BRST 2008
450</SMALL>490</SMALL>
451<!--491<!--
452Last change: minor edit492Last change: revised for Lua 5.1.3
453-->493-->
454 494
455</BODY>495</BODY>
doc/manual.css+6−0
@@ -5,3 +5,9 @@ h3 code { · 4 unmodified lines
5pre {5pre {
6 font-size: 105% ;6 font-size: 105% ;
7}7}
8
9span.apii {
10 float: right ;
11 font-family: inherit ;
12}
13
doc/manual.html+513−285
@@ -18,7 +18,7 @@ Lua 5.1 Reference Manual · 17 unmodified lines
18by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes18by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes
19<p>19<p>
20<small>20<small>
21Copyright &copy; 2006-2007 Lua.org, PUC-Rio.21Copyright &copy; 2006-2008 Lua.org, PUC-Rio.
22Freely available under the terms of the22Freely available under the terms of the
23<a href="http://www.lua.org/license.html#5">Lua license</a>.23<a href="http://www.lua.org/license.html#5">Lua license</a>.
24</small>24</small>
@@ -32,6 +32,7 @@ Freely available under the terms of the · 7 unmodified lines
32<!-- ====================================================================== -->32<!-- ====================================================================== -->
33<p>33<p>
34 34
35<!-- $Id: manual.of,v 1.43 2008/01/17 16:19:44 roberto Exp $ -->
35 36
36 37
37 38
@@ -554,9 +555,9 @@ and a list of expressions on the right side. · 516 unmodified lines
554The elements in both lists are separated by commas:555The elements in both lists are separated by commas:
555 556
556<pre>557<pre>
557 stat ::= varlist1 `<b>=</b>&acute; explist1558 stat ::= varlist `<b>=</b>&acute; explist
558 varlist1 ::= var {`<b>,</b>&acute; var}559 varlist ::= var {`<b>,</b>&acute; var}
559 explist1 ::= exp {`<b>,</b>&acute; exp}560 explist ::= exp {`<b>,</b>&acute; exp}
560</pre><p>561</pre><p>
561Expressions are discussed in <a href="#2.5">&sect;2.5</a>.562Expressions are discussed in <a href="#2.5">&sect;2.5</a>.
562 563
@@ -663,7 +664,7 @@ Functions and chunks may return more than one value, · 100 unmodified lines
663so the syntax for the <b>return</b> statement is664so the syntax for the <b>return</b> statement is
664 665
665<pre>666<pre>
666 stat ::= <b>return</b> [explist1]667 stat ::= <b>return</b> [explist]
667</pre>668</pre>
668 669
669<p>670<p>
@@ -771,7 +772,7 @@ stopping when this new value is <b>nil</b>. · 101 unmodified lines
771The generic <b>for</b> loop has the following syntax:772The generic <b>for</b> loop has the following syntax:
772 773
773<pre>774<pre>
774 stat ::= <b>for</b> namelist <b>in</b> explist1 <b>do</b> block <b>end</b>775 stat ::= <b>for</b> namelist <b>in</b> explist <b>do</b> block <b>end</b>
775 namelist ::= Name {`<b>,</b>&acute; Name}776 namelist ::= Name {`<b>,</b>&acute; Name}
776</pre><p>777</pre><p>
777A <b>for</b> statement like778A <b>for</b> statement like
@@ -843,7 +844,7 @@ Local variables may be declared anywhere inside a block. · 65 unmodified lines
843The declaration may include an initial assignment:844The declaration may include an initial assignment:
844 845
845<pre>846<pre>
846 stat ::= <b>local</b> namelist [`<b>=</b>&acute; explist1]847 stat ::= <b>local</b> namelist [`<b>=</b>&acute; explist]
847</pre><p>848</pre><p>
848If present, an initial assignment has the same semantics849If present, an initial assignment has the same semantics
849of a multiple assignment (see <a href="#2.4.3">&sect;2.4.3</a>).850of a multiple assignment (see <a href="#2.4.3">&sect;2.4.3</a>).
@@ -1221,7 +1222,7 @@ except that <code>v</code> is evaluated only once. · 371 unmodified lines
1221Arguments have the following syntax:1222Arguments have the following syntax:
1222 1223
1223<pre>1224<pre>
1224 args ::= `<b>(</b>&acute; [explist1] `<b>)</b>&acute;1225 args ::= `<b>(</b>&acute; [explist] `<b>)</b>&acute;
1225 args ::= tableconstructor1226 args ::= tableconstructor
1226 args ::= String1227 args ::= String
1227</pre><p>1228</pre><p>
@@ -1286,7 +1287,7 @@ The syntax for function definition is · 58 unmodified lines
1286 1287
1287<pre>1288<pre>
1288 function ::= <b>function</b> funcbody1289 function ::= <b>function</b> funcbody
1289 funcbody ::= `<b>(</b>&acute; [parlist1] `<b>)</b>&acute; block <b>end</b>1290 funcbody ::= `<b>(</b>&acute; [parlist] `<b>)</b>&acute; block <b>end</b>
1290</pre>1291</pre>
1291 1292
1292<p>1293<p>
@@ -1355,7 +1356,7 @@ Parameters act as local variables that are · 62 unmodified lines
1355initialized with the argument values:1356initialized with the argument values:
1356 1357
1357<pre>1358<pre>
1358 parlist1 ::= namelist [`<b>,</b>&acute; `<b>...</b>&acute;] | `<b>...</b>&acute;1359 parlist ::= namelist [`<b>,</b>&acute; `<b>...</b>&acute;] | `<b>...</b>&acute;
1359</pre><p>1360</pre><p>
1360When a function is called,1361When a function is called,
1361the list of arguments is adjusted to1362the list of arguments is adjusted to
@@ -1551,11 +1552,11 @@ you must use the C&nbsp;API for that. · 189 unmodified lines
1551 1552
1552 1553
1553<p>1554<p>
1554Tables and userdata have individual metatables1555Tables and full userdata have individual metatables
1555(although multiple tables and userdata can share their metatables);1556(although multiple tables and userdata can share their metatables);
1556values of all other types share one single metatable per type.1557values of all other types share one single metatable per type.
1557So, there is one single metatable for all numbers,1558So, there is one single metatable for all numbers,
1558and for all strings, etc.1559one for all strings, etc.
1559 1560
1560 1561
1561<p>1562<p>
@@ -1638,7 +1639,7 @@ the behavior of the <code>op1 + op2</code> is · 76 unmodified lines
1638 local h = getbinhandler(op1, op2, "__add")1639 local h = getbinhandler(op1, op2, "__add")
1639 if h then1640 if h then
1640 -- call the handler with both operands1641 -- call the handler with both operands
1641 return h(op1, op2)1642 return (h(op1, op2))
1642 else -- no handler available: default behavior1643 else -- no handler available: default behavior
1643 error(&middot;&middot;&middot;)1644 error(&middot;&middot;&middot;)
1644 end1645 end
@@ -1695,7 +1696,7 @@ the unary <code>-</code> operation. · 50 unmodified lines
1695 local h = metatable(op).__unm1696 local h = metatable(op).__unm
1696 if h then1697 if h then
1697 -- call the handler with the operand1698 -- call the handler with the operand
1698 return h(op)1699 return (h(op))
1699 else -- no handler available: default behavior1700 else -- no handler available: default behavior
1700 error(&middot;&middot;&middot;)1701 error(&middot;&middot;&middot;)
1701 end1702 end
@@ -1716,7 +1717,7 @@ the <code>..</code> (concatenation) operation. · 14 unmodified lines
1716 else1717 else
1717 local h = getbinhandler(op1, op2, "__concat")1718 local h = getbinhandler(op1, op2, "__concat")
1718 if h then1719 if h then
1719 return h(op1, op2)1720 return (h(op1, op2))
1720 else1721 else
1721 error(&middot;&middot;&middot;)1722 error(&middot;&middot;&middot;)
1722 end1723 end
@@ -1739,7 +1740,7 @@ the <code>#</code> operation. · 16 unmodified lines
1739 local h = metatable(op).__len1740 local h = metatable(op).__len
1740 if h then1741 if h then
1741 -- call the handler with the operand1742 -- call the handler with the operand
1742 return h(op)1743 return (h(op))
1743 else -- no handler available: default behavior1744 else -- no handler available: default behavior
1744 error(&middot;&middot;&middot;)1745 error(&middot;&middot;&middot;)
1745 end1746 end
@@ -1779,7 +1780,7 @@ The "eq" event is defined as follows: · 33 unmodified lines
1779 -- try metamethod1780 -- try metamethod
1780 local h = getcomphandler(op1, op2, "__eq")1781 local h = getcomphandler(op1, op2, "__eq")
1781 if h then1782 if h then
1782 return h(op1, op2)1783 return (h(op1, op2))
1783 else1784 else
1784 return false1785 return false
1785 end1786 end
@@ -1801,7 +1802,7 @@ the <code>&lt;</code> operation. · 15 unmodified lines
1801 else1802 else
1802 local h = getcomphandler(op1, op2, "__lt")1803 local h = getcomphandler(op1, op2, "__lt")
1803 if h then1804 if h then
1804 return h(op1, op2)1805 return (h(op1, op2))
1805 else1806 else
1806 error(&middot;&middot;&middot;);1807 error(&middot;&middot;&middot;);
1807 end1808 end
@@ -1824,7 +1825,7 @@ the <code>&lt;=</code> operation. · 16 unmodified lines
1824 else1825 else
1825 local h = getcomphandler(op1, op2, "__le")1826 local h = getcomphandler(op1, op2, "__le")
1826 if h then1827 if h then
1827 return h(op1, op2)1828 return (h(op1, op2))
1828 else1829 else
1829 h = getcomphandler(op1, op2, "__lt")1830 h = getcomphandler(op1, op2, "__lt")
1830 if h then1831 if h then
@@ -1861,8 +1862,8 @@ The indexing access <code>table[key]</code>. · 30 unmodified lines
1861 end1862 end
1862 end1863 end
1863 if type(h) == "function" then1864 if type(h) == "function" then
1864 return h(table, key) -- call the handler1865 return (h(table, key)) -- call the handler
1865 else return h[key] -- or repeat operation on it1866 else return h[key] -- or repeat operation on it
1866 end1867 end
1867 end1868 end
1868</pre><p>1869</pre><p>
@@ -1887,7 +1888,7 @@ The indexing assignment <code>table[key] = value</code>. · 18 unmodified lines
1887 end1888 end
1888 end1889 end
1889 if type(h) == "function" then1890 if type(h) == "function" then
1890 return h(table, key,value) -- call the handler1891 h(table, key,value) -- call the handler
1891 else h[key] = value -- or repeat operation on it1892 else h[key] = value -- or repeat operation on it
1892 end1893 end
1893 end1894 end
@@ -2062,6 +2063,7 @@ order of their creation, · 168 unmodified lines
2062among those collected in that cycle.2063among those collected in that cycle.
2063That is, the first finalizer to be called is the one associated2064That is, the first finalizer to be called is the one associated
2064with the userdata created last in the program.2065with the userdata created last in the program.
2066The userdata itself is freed only in the next garbage-collection cycle.
2065 2067
2066 2068
2067 2069
@@ -2427,17 +2429,14 @@ any error jumps to the most recent active recover point. · 359 unmodified lines
2427 2429
2428 2430
2429<p>2431<p>
2430Almost any function in the API may raise an error,2432Most functions in the API may throw an error,
2431for instance due to a memory allocation error.2433for instance due to a memory allocation error.
2432The following functions run in protected mode2434The documentation for each function indicates whether
2433(that is, they create a protected environment to run),2435it can throw errors.
2434so they never raise an error:
2435<a href="#lua_newstate"><code>lua_newstate</code></a>, <a href="#lua_close"><code>lua_close</code></a>, <a href="#lua_load"><code>lua_load</code></a>,
2436<a href="#lua_pcall"><code>lua_pcall</code></a>, and <a href="#lua_cpcall"><code>lua_cpcall</code></a>.
2437 2436
2438 2437
2439<p>2438<p>
2440Inside a C&nbsp;function you can raise an error by calling <a href="#lua_error"><code>lua_error</code></a>.2439Inside a C&nbsp;function you can throw an error by calling <a href="#lua_error"><code>lua_error</code></a>.
2441 2440
2442 2441
2443 2442
@@ -2448,6 +2447,30 @@ Inside a C&nbsp;function you can raise an error by calling <a href="#lua_error"> · 4 unmodified lines
2448<p>2447<p>
2449Here we list all functions and types from the C&nbsp;API in2448Here we list all functions and types from the C&nbsp;API in
2450alphabetical order.2449alphabetical order.
2450Each function has an indicator like this:
2451<span class="apii">[-o, +p, <em>x</em>]</span>
2452
2453
2454<p>
2455The first field, <code>o</code>,
2456is how many elements the function pops from the stack.
2457The second field, <code>p</code>,
2458is how many elements the function pushes onto the stack.
2459(Any function always pushes its results after popping its arguments.)
2460A field in the form <code>x|y</code> means the function may push (or pop)
2461<code>x</code> or <code>y</code> elements,
2462depending on the situation;
2463an interrogation mark '<code>?</code>' means that
2464we cannot know how many elements the function pops/pushes
2465by looking only at its arguments
2466(e.g., they may depend on what is on the stack).
2467The third field, <code>x</code>,
2468tells whether the function may throw errors:
2469'<code>-</code>' means the function never throws any error;
2470'<code>m</code>' means the function may throw an error
2471only due to not enough memory;
2472'<code>e</code>' means the function may throw other kinds of errors;
2473'<code>v</code>' means the function may throw an error on purpose.
2451 2474
2452 2475
2453 2476
@@ -2506,7 +2529,8 @@ ANSI&nbsp;C ensures both behaviors. · 52 unmodified lines
2506 2529
2507 2530
2508 2531
2509<hr><h3><a name="lua_atpanic"><code>lua_atpanic</code></a></h3>2532<hr><h3><a name="lua_atpanic"><code>lua_atpanic</code></a></h3><p>
2533<span class="apii">[-0, +0, <em>-</em>]</span>
2510<pre>lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);</pre>2534<pre>lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);</pre>
2511 2535
2512<p>2536<p>
@@ -2529,7 +2553,8 @@ The panic function can access the error message at the top of the stack. · 16 unmodified lines
2529 2553
2530 2554
2531 2555
2532<hr><h3><a name="lua_call"><code>lua_call</code></a></h3>2556<hr><h3><a name="lua_call"><code>lua_call</code></a></h3><p>
2557<span class="apii">[-(nargs + 1), +nresults, <em>e</em>]</span>
2533<pre>void lua_call (lua_State *L, int nargs, int nresults);</pre>2558<pre>void lua_call (lua_State *L, int nargs, int nresults);</pre>
2534 2559
2535<p>2560<p>
@@ -2639,7 +2664,8 @@ of numerical arguments and returns their average and sum: · 103 unmodified lines
2639 2664
2640 2665
2641 2666
2642<hr><h3><a name="lua_checkstack"><code>lua_checkstack</code></a></h3>2667<hr><h3><a name="lua_checkstack"><code>lua_checkstack</code></a></h3><p>
2668<span class="apii">[-0, +0, <em>-</em>]</span>
2643<pre>int lua_checkstack (lua_State *L, int extra);</pre>2669<pre>int lua_checkstack (lua_State *L, int extra);</pre>
2644 2670
2645<p>2671<p>
@@ -2653,7 +2679,8 @@ it is left unchanged. · 7 unmodified lines
2653 2679
2654 2680
2655 2681
2656<hr><h3><a name="lua_close"><code>lua_close</code></a></h3>2682<hr><h3><a name="lua_close"><code>lua_close</code></a></h3><p>
2683<span class="apii">[-0, +0, <em>-</em>]</span>
2657<pre>void lua_close (lua_State *L);</pre>2684<pre>void lua_close (lua_State *L);</pre>
2658 2685
2659<p>2686<p>
@@ -2671,23 +2698,25 @@ to avoid growing too large. · 11 unmodified lines
2671 2698
2672 2699
2673 2700
2674<hr><h3><a name="lua_concat"><code>lua_concat</code></a></h3>2701<hr><h3><a name="lua_concat"><code>lua_concat</code></a></h3><p>
2702<span class="apii">[-n, +1, <em>e</em>]</span>
2675<pre>void lua_concat (lua_State *L, int n);</pre>2703<pre>void lua_concat (lua_State *L, int n);</pre>
2676 2704
2677<p>2705<p>
2678Concatenates the <code>n</code> values at the top of the stack,2706Concatenates the <code>n</code> values at the top of the stack,
2679pops them, and leaves the result at the top.2707pops them, and leaves the result at the top.
2680If <code>n</code>&nbsp;is&nbsp;1, the result is the single string on the stack2708If <code>n</code>&nbsp;is&nbsp;1, the result is the single value on the stack
2681(that is, the function does nothing);2709(that is, the function does nothing);
2682if <code>n</code> is 0, the result is the empty string.2710if <code>n</code> is 0, the result is the empty string.
2683Concatenation is done following the usual semantics of Lua2711Concatenation is performed following the usual semantics of Lua
2684(see <a href="#2.5.4">&sect;2.5.4</a>).2712(see <a href="#2.5.4">&sect;2.5.4</a>).
2685 2713
2686 2714
2687 2715
2688 2716
2689 2717
2690<hr><h3><a name="lua_cpcall"><code>lua_cpcall</code></a></h3>2718<hr><h3><a name="lua_cpcall"><code>lua_cpcall</code></a></h3><p>
2719<span class="apii">[-0, +(0|1), <em>-</em>]</span>
2691<pre>int lua_cpcall (lua_State *L, lua_CFunction func, void *ud);</pre>2720<pre>int lua_cpcall (lua_State *L, lua_CFunction func, void *ud);</pre>
2692 2721
2693<p>2722<p>
@@ -2704,7 +2733,8 @@ All values returned by <code>func</code> are discarded. · 10 unmodified lines
2704 2733
2705 2734
2706 2735
2707<hr><h3><a name="lua_createtable"><code>lua_createtable</code></a></h3>2736<hr><h3><a name="lua_createtable"><code>lua_createtable</code></a></h3><p>
2737<span class="apii">[-0, +1, <em>m</em>]</span>
2708<pre>void lua_createtable (lua_State *L, int narr, int nrec);</pre>2738<pre>void lua_createtable (lua_State *L, int narr, int nrec);</pre>
2709 2739
2710<p>2740<p>
@@ -2719,7 +2749,8 @@ Otherwise you can use the function <a href="#lua_newtable"><code>lua_newtable</c · 8 unmodified lines
2719 2749
2720 2750
2721 2751
2722<hr><h3><a name="lua_dump"><code>lua_dump</code></a></h3>2752<hr><h3><a name="lua_dump"><code>lua_dump</code></a></h3><p>
2753<span class="apii">[-0, +0, <em>m</em>]</span>
2723<pre>int lua_dump (lua_State *L, lua_Writer writer, void *data);</pre>2754<pre>int lua_dump (lua_State *L, lua_Writer writer, void *data);</pre>
2724 2755
2725<p>2756<p>
@@ -2747,7 +2778,8 @@ This function does not pop the Lua function from the stack. · 21 unmodified lines
2747 2778
2748 2779
2749 2780
2750<hr><h3><a name="lua_equal"><code>lua_equal</code></a></h3>2781<hr><h3><a name="lua_equal"><code>lua_equal</code></a></h3><p>
2782<span class="apii">[-0, +0, <em>e</em>]</span>
2751<pre>int lua_equal (lua_State *L, int index1, int index2);</pre>2783<pre>int lua_equal (lua_State *L, int index1, int index2);</pre>
2752 2784
2753<p>2785<p>
@@ -2762,7 +2794,8 @@ Also returns&nbsp;0 if any of the indices is non valid. · 8 unmodified lines
2762 2794
2763 2795
2764 2796
2765<hr><h3><a name="lua_error"><code>lua_error</code></a></h3>2797<hr><h3><a name="lua_error"><code>lua_error</code></a></h3><p>
2798<span class="apii">[-1, +0, <em>v</em>]</span>
2766<pre>int lua_error (lua_State *L);</pre>2799<pre>int lua_error (lua_State *L);</pre>
2767 2800
2768<p>2801<p>
@@ -2777,7 +2810,8 @@ and therefore never returns. · 8 unmodified lines
2777 2810
2778 2811
2779 2812
2780<hr><h3><a name="lua_gc"><code>lua_gc</code></a></h3>2813<hr><h3><a name="lua_gc"><code>lua_gc</code></a></h3><p>
2814<span class="apii">[-0, +0, <em>e</em>]</span>
2781<pre>int lua_gc (lua_State *L, int what, int data);</pre>2815<pre>int lua_gc (lua_State *L, int what, int data);</pre>
2782 2816
2783<p>2817<p>
@@ -2838,7 +2872,8 @@ The function returns the previous value of the step multiplier. · 54 unmodified lines
2838 2872
2839 2873
2840 2874
2841<hr><h3><a name="lua_getallocf"><code>lua_getallocf</code></a></h3>2875<hr><h3><a name="lua_getallocf"><code>lua_getallocf</code></a></h3><p>
2876<span class="apii">[-0, +0, <em>-</em>]</span>
2842<pre>lua_Alloc lua_getallocf (lua_State *L, void **ud);</pre>2877<pre>lua_Alloc lua_getallocf (lua_State *L, void **ud);</pre>
2843 2878
2844<p>2879<p>
@@ -2850,7 +2885,8 @@ opaque pointer passed to <a href="#lua_newstate"><code>lua_newstate</code></a>. · 5 unmodified lines
2850 2885
2851 2886
2852 2887
2853<hr><h3><a name="lua_getfenv"><code>lua_getfenv</code></a></h3>2888<hr><h3><a name="lua_getfenv"><code>lua_getfenv</code></a></h3><p>
2889<span class="apii">[-0, +1, <em>-</em>]</span>
2854<pre>void lua_getfenv (lua_State *L, int index);</pre>2890<pre>void lua_getfenv (lua_State *L, int index);</pre>
2855 2891
2856<p>2892<p>
@@ -2861,12 +2897,13 @@ the value at the given index. · 4 unmodified lines
2861 2897
2862 2898
2863 2899
2864<hr><h3><a name="lua_getfield"><code>lua_getfield</code></a></h3>2900<hr><h3><a name="lua_getfield"><code>lua_getfield</code></a></h3><p>
2901<span class="apii">[-0, +1, <em>e</em>]</span>
2865<pre>void lua_getfield (lua_State *L, int index, const char *k);</pre>2902<pre>void lua_getfield (lua_State *L, int index, const char *k);</pre>
2866 2903
2867<p>2904<p>
2868Pushes onto the stack the value <code>t[k]</code>,2905Pushes onto the stack the value <code>t[k]</code>,
2869where <code>t</code> is the value at the given valid index <code>index</code>.2906where <code>t</code> is the value at the given valid index.
2870As in Lua, this function may trigger a metamethod2907As in Lua, this function may trigger a metamethod
2871for the "index" event (see <a href="#2.8">&sect;2.8</a>).2908for the "index" event (see <a href="#2.8">&sect;2.8</a>).
2872 2909
@@ -2874,7 +2911,8 @@ for the "index" event (see <a href="#2.8">&sect;2.8</a>). · 1 unmodified line
2874 2911
2875 2912
2876 2913
2877<hr><h3><a name="lua_getglobal"><code>lua_getglobal</code></a></h3>2914<hr><h3><a name="lua_getglobal"><code>lua_getglobal</code></a></h3><p>
2915<span class="apii">[-0, +1, <em>e</em>]</span>
2878<pre>void lua_getglobal (lua_State *L, const char *name);</pre>2916<pre>void lua_getglobal (lua_State *L, const char *name);</pre>
2879 2917
2880<p>2918<p>
@@ -2888,7 +2926,8 @@ It is defined as a macro: · 7 unmodified lines
2888 2926
2889 2927
2890 2928
2891<hr><h3><a name="lua_getmetatable"><code>lua_getmetatable</code></a></h3>2929<hr><h3><a name="lua_getmetatable"><code>lua_getmetatable</code></a></h3><p>
2930<span class="apii">[-0, +(0|1), <em>-</em>]</span>
2892<pre>int lua_getmetatable (lua_State *L, int index);</pre>2931<pre>int lua_getmetatable (lua_State *L, int index);</pre>
2893 2932
2894<p>2933<p>
@@ -2902,12 +2941,13 @@ the function returns&nbsp;0 and pushes nothing on the stack. · 7 unmodified lines
2902 2941
2903 2942
2904 2943
2905<hr><h3><a name="lua_gettable"><code>lua_gettable</code></a></h3>2944<hr><h3><a name="lua_gettable"><code>lua_gettable</code></a></h3><p>
2945<span class="apii">[-1, +1, <em>e</em>]</span>
2906<pre>void lua_gettable (lua_State *L, int index);</pre>2946<pre>void lua_gettable (lua_State *L, int index);</pre>
2907 2947
2908<p>2948<p>
2909Pushes onto the stack the value <code>t[k]</code>,2949Pushes onto the stack the value <code>t[k]</code>,
2910where <code>t</code> is the value at the given valid index <code>index</code>2950where <code>t</code> is the value at the given valid index
2911and <code>k</code> is the value at the top of the stack.2951and <code>k</code> is the value at the top of the stack.
2912 2952
2913 2953
@@ -2921,7 +2961,8 @@ for the "index" event (see <a href="#2.8">&sect;2.8</a>). · 7 unmodified lines
2921 2961
2922 2962
2923 2963
2924<hr><h3><a name="lua_gettop"><code>lua_gettop</code></a></h3>2964<hr><h3><a name="lua_gettop"><code>lua_gettop</code></a></h3><p>
2965<span class="apii">[-0, +0, <em>-</em>]</span>
2925<pre>int lua_gettop (lua_State *L);</pre>2966<pre>int lua_gettop (lua_State *L);</pre>
2926 2967
2927<p>2968<p>
@@ -2934,7 +2975,8 @@ this result is equal to the number of elements in the stack · 6 unmodified lines
2934 2975
2935 2976
2936 2977
2937<hr><h3><a name="lua_insert"><code>lua_insert</code></a></h3>2978<hr><h3><a name="lua_insert"><code>lua_insert</code></a></h3><p>
2979<span class="apii">[-1, +1, <em>-</em>]</span>
2938<pre>void lua_insert (lua_State *L, int index);</pre>2980<pre>void lua_insert (lua_State *L, int index);</pre>
2939 2981
2940<p>2982<p>
@@ -2963,7 +3005,8 @@ which is usually the largest signed integral type the machine handles · 22 unmodified lines
2963 3005
2964 3006
2965 3007
2966<hr><h3><a name="lua_isboolean"><code>lua_isboolean</code></a></h3>3008<hr><h3><a name="lua_isboolean"><code>lua_isboolean</code></a></h3><p>
3009<span class="apii">[-0, +0, <em>-</em>]</span>
2967<pre>int lua_isboolean (lua_State *L, int index);</pre>3010<pre>int lua_isboolean (lua_State *L, int index);</pre>
2968 3011
2969<p>3012<p>
@@ -2974,7 +3017,8 @@ and 0&nbsp;otherwise. · 4 unmodified lines
2974 3017
2975 3018
2976 3019
2977<hr><h3><a name="lua_iscfunction"><code>lua_iscfunction</code></a></h3>3020<hr><h3><a name="lua_iscfunction"><code>lua_iscfunction</code></a></h3><p>
3021<span class="apii">[-0, +0, <em>-</em>]</span>
2978<pre>int lua_iscfunction (lua_State *L, int index);</pre>3022<pre>int lua_iscfunction (lua_State *L, int index);</pre>
2979 3023
2980<p>3024<p>
@@ -2985,7 +3029,8 @@ and 0&nbsp;otherwise. · 4 unmodified lines
2985 3029
2986 3030
2987 3031
2988<hr><h3><a name="lua_isfunction"><code>lua_isfunction</code></a></h3>3032<hr><h3><a name="lua_isfunction"><code>lua_isfunction</code></a></h3><p>
3033<span class="apii">[-0, +0, <em>-</em>]</span>
2989<pre>int lua_isfunction (lua_State *L, int index);</pre>3034<pre>int lua_isfunction (lua_State *L, int index);</pre>
2990 3035
2991<p>3036<p>
@@ -2996,7 +3041,8 @@ Returns 1 if the value at the given acceptable index is a function · 4 unmodified lines
2996 3041
2997 3042
2998 3043
2999<hr><h3><a name="lua_islightuserdata"><code>lua_islightuserdata</code></a></h3>3044<hr><h3><a name="lua_islightuserdata"><code>lua_islightuserdata</code></a></h3><p>
3045<span class="apii">[-0, +0, <em>-</em>]</span>
3000<pre>int lua_islightuserdata (lua_State *L, int index);</pre>3046<pre>int lua_islightuserdata (lua_State *L, int index);</pre>
3001 3047
3002<p>3048<p>
@@ -3007,7 +3053,8 @@ and 0&nbsp;otherwise. · 4 unmodified lines
3007 3053
3008 3054
3009 3055
3010<hr><h3><a name="lua_isnil"><code>lua_isnil</code></a></h3>3056<hr><h3><a name="lua_isnil"><code>lua_isnil</code></a></h3><p>
3057<span class="apii">[-0, +0, <em>-</em>]</span>
3011<pre>int lua_isnil (lua_State *L, int index);</pre>3058<pre>int lua_isnil (lua_State *L, int index);</pre>
3012 3059
3013<p>3060<p>
@@ -3018,11 +3065,12 @@ and 0&nbsp;otherwise. · 4 unmodified lines
3018 3065
3019 3066
3020 3067
3021<hr><h3><a name="lua_isnone"><code>lua_isnone</code></a></h3>3068<hr><h3><a name="lua_isnone"><code>lua_isnone</code></a></h3><p>
3069<span class="apii">[-0, +0, <em>-</em>]</span>
3022<pre>int lua_isnone (lua_State *L, int index);</pre>3070<pre>int lua_isnone (lua_State *L, int index);</pre>
3023 3071
3024<p>3072<p>
3025Returns 1 if the the given acceptable index is not valid3073Returns 1 if the given acceptable index is not valid
3026(that is, it refers to an element outside the current stack),3074(that is, it refers to an element outside the current stack),
3027and 0&nbsp;otherwise.3075and 0&nbsp;otherwise.
3028 3076
@@ -3030,11 +3078,12 @@ and 0&nbsp;otherwise. · 1 unmodified line
3030 3078
3031 3079
3032 3080
3033<hr><h3><a name="lua_isnoneornil"><code>lua_isnoneornil</code></a></h3>3081<hr><h3><a name="lua_isnoneornil"><code>lua_isnoneornil</code></a></h3><p>
3082<span class="apii">[-0, +0, <em>-</em>]</span>
3034<pre>int lua_isnoneornil (lua_State *L, int index);</pre>3083<pre>int lua_isnoneornil (lua_State *L, int index);</pre>
3035 3084
3036<p>3085<p>
3037Returns 1 if the the given acceptable index is not valid3086Returns 1 if the given acceptable index is not valid
3038(that is, it refers to an element outside the current stack)3087(that is, it refers to an element outside the current stack)
3039or if the value at this index is <b>nil</b>,3088or if the value at this index is <b>nil</b>,
3040and 0&nbsp;otherwise.3089and 0&nbsp;otherwise.
@@ -3043,7 +3092,8 @@ and 0&nbsp;otherwise. · 2 unmodified lines
3043 3092
3044 3093
3045 3094
3046<hr><h3><a name="lua_isnumber"><code>lua_isnumber</code></a></h3>3095<hr><h3><a name="lua_isnumber"><code>lua_isnumber</code></a></h3><p>
3096<span class="apii">[-0, +0, <em>-</em>]</span>
3047<pre>int lua_isnumber (lua_State *L, int index);</pre>3097<pre>int lua_isnumber (lua_State *L, int index);</pre>
3048 3098
3049<p>3099<p>
@@ -3055,7 +3105,8 @@ and 0&nbsp;otherwise. · 5 unmodified lines
3055 3105
3056 3106
3057 3107
3058<hr><h3><a name="lua_isstring"><code>lua_isstring</code></a></h3>3108<hr><h3><a name="lua_isstring"><code>lua_isstring</code></a></h3><p>
3109<span class="apii">[-0, +0, <em>m</em>]</span>
3059<pre>int lua_isstring (lua_State *L, int index);</pre>3110<pre>int lua_isstring (lua_State *L, int index);</pre>
3060 3111
3061<p>3112<p>
@@ -3067,7 +3118,8 @@ and 0&nbsp;otherwise. · 5 unmodified lines
3067 3118
3068 3119
3069 3120
3070<hr><h3><a name="lua_istable"><code>lua_istable</code></a></h3>3121<hr><h3><a name="lua_istable"><code>lua_istable</code></a></h3><p>
3122<span class="apii">[-0, +0, <em>-</em>]</span>
3071<pre>int lua_istable (lua_State *L, int index);</pre>3123<pre>int lua_istable (lua_State *L, int index);</pre>
3072 3124
3073<p>3125<p>
@@ -3078,7 +3130,8 @@ and 0&nbsp;otherwise. · 4 unmodified lines
3078 3130
3079 3131
3080 3132
3081<hr><h3><a name="lua_isthread"><code>lua_isthread</code></a></h3>3133<hr><h3><a name="lua_isthread"><code>lua_isthread</code></a></h3><p>
3134<span class="apii">[-0, +0, <em>-</em>]</span>
3082<pre>int lua_isthread (lua_State *L, int index);</pre>3135<pre>int lua_isthread (lua_State *L, int index);</pre>
3083 3136
3084<p>3137<p>
@@ -3089,7 +3142,8 @@ and 0&nbsp;otherwise. · 4 unmodified lines
3089 3142
3090 3143
3091 3144
3092<hr><h3><a name="lua_isuserdata"><code>lua_isuserdata</code></a></h3>3145<hr><h3><a name="lua_isuserdata"><code>lua_isuserdata</code></a></h3><p>
3146<span class="apii">[-0, +0, <em>-</em>]</span>
3093<pre>int lua_isuserdata (lua_State *L, int index);</pre>3147<pre>int lua_isuserdata (lua_State *L, int index);</pre>
3094 3148
3095<p>3149<p>
@@ -3100,7 +3154,8 @@ Returns 1 if the value at the given acceptable index is a userdata · 4 unmodified lines
3100 3154
3101 3155
3102 3156
3103<hr><h3><a name="lua_lessthan"><code>lua_lessthan</code></a></h3>3157<hr><h3><a name="lua_lessthan"><code>lua_lessthan</code></a></h3><p>
3158<span class="apii">[-0, +0, <em>e</em>]</span>
3104<pre>int lua_lessthan (lua_State *L, int index1, int index2);</pre>3159<pre>int lua_lessthan (lua_State *L, int index1, int index2);</pre>
3105 3160
3106<p>3161<p>
@@ -3115,7 +3170,8 @@ Also returns&nbsp;0 if any of the indices is non valid. · 8 unmodified lines
3115 3170
3116 3171
3117 3172
3118<hr><h3><a name="lua_load"><code>lua_load</code></a></h3>3173<hr><h3><a name="lua_load"><code>lua_load</code></a></h3><p>
3174<span class="apii">[-0, +1, <em>-</em>]</span>
3119<pre>int lua_load (lua_State *L,3175<pre>int lua_load (lua_State *L,
3120 lua_Reader reader,3176 lua_Reader reader,
3121 void *data,3177 void *data,
@@ -3165,7 +3221,8 @@ which is used for error messages and in debug information (see <a href="#3.8">&s · 43 unmodified lines
3165 3221
3166 3222
3167 3223
3168<hr><h3><a name="lua_newstate"><code>lua_newstate</code></a></h3>3224<hr><h3><a name="lua_newstate"><code>lua_newstate</code></a></h3><p>
3225<span class="apii">[-0, +0, <em>-</em>]</span>
3169<pre>lua_State *lua_newstate (lua_Alloc f, void *ud);</pre>3226<pre>lua_State *lua_newstate (lua_Alloc f, void *ud);</pre>
3170 3227
3171<p>3228<p>
@@ -3181,7 +3238,8 @@ simply passes to the allocator in every call. · 9 unmodified lines
3181 3238
3182 3239
3183 3240
3184<hr><h3><a name="lua_newtable"><code>lua_newtable</code></a></h3>3241<hr><h3><a name="lua_newtable"><code>lua_newtable</code></a></h3><p>
3242<span class="apii">[-0, +1, <em>m</em>]</span>
3185<pre>void lua_newtable (lua_State *L);</pre>3243<pre>void lua_newtable (lua_State *L);</pre>
3186 3244
3187<p>3245<p>
@@ -3192,7 +3250,8 @@ It is equivalent to <code>lua_createtable(L, 0, 0)</code>. · 4 unmodified lines
3192 3250
3193 3251
3194 3252
3195<hr><h3><a name="lua_newthread"><code>lua_newthread</code></a></h3>3253<hr><h3><a name="lua_newthread"><code>lua_newthread</code></a></h3><p>
3254<span class="apii">[-0, +1, <em>m</em>]</span>
3196<pre>lua_State *lua_newthread (lua_State *L);</pre>3255<pre>lua_State *lua_newthread (lua_State *L);</pre>
3197 3256
3198<p>3257<p>
@@ -3212,7 +3271,8 @@ like any Lua object. · 13 unmodified lines
3212 3271
3213 3272
3214 3273
3215<hr><h3><a name="lua_newuserdata"><code>lua_newuserdata</code></a></h3>3274<hr><h3><a name="lua_newuserdata"><code>lua_newuserdata</code></a></h3><p>
3275<span class="apii">[-0, +1, <em>m</em>]</span>
3216<pre>void *lua_newuserdata (lua_State *L, size_t size);</pre>3276<pre>void *lua_newuserdata (lua_State *L, size_t size);</pre>
3217 3277
3218<p>3278<p>
@@ -3240,7 +3300,8 @@ Lua frees its corresponding memory. · 21 unmodified lines
3240 3300
3241 3301
3242 3302
3243<hr><h3><a name="lua_next"><code>lua_next</code></a></h3>3303<hr><h3><a name="lua_next"><code>lua_next</code></a></h3><p>
3304<span class="apii">[-1, +(2|0), <em>e</em>]</span>
3244<pre>int lua_next (lua_State *L, int index);</pre>3305<pre>int lua_next (lua_State *L, int index);</pre>
3245 3306
3246<p>3307<p>
@@ -3295,7 +3356,8 @@ Lua to operate with another type for numbers (e.g., float or long). · 48 unmodified lines
3295 3356
3296 3357
3297 3358
3298<hr><h3><a name="lua_objlen"><code>lua_objlen</code></a></h3>3359<hr><h3><a name="lua_objlen"><code>lua_objlen</code></a></h3><p>
3360<span class="apii">[-0, +0, <em>-</em>]</span>
3299<pre>size_t lua_objlen (lua_State *L, int index);</pre>3361<pre>size_t lua_objlen (lua_State *L, int index);</pre>
3300 3362
3301<p>3363<p>
@@ -3310,7 +3372,8 @@ for other values, it is&nbsp;0. · 8 unmodified lines
3310 3372
3311 3373
3312 3374
3313<hr><h3><a name="lua_pcall"><code>lua_pcall</code></a></h3>3375<hr><h3><a name="lua_pcall"><code>lua_pcall</code></a></h3><p>
3376<span class="apii">[-(nargs + 1), +(nresults|1), <em>-</em>]</span>
3314<pre>int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc);</pre>3377<pre>int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc);</pre>
3315 3378
3316<p>3379<p>
@@ -3375,7 +3438,8 @@ error while running the error handler function. · 58 unmodified lines
3375 3438
3376 3439
3377 3440
3378<hr><h3><a name="lua_pop"><code>lua_pop</code></a></h3>3441<hr><h3><a name="lua_pop"><code>lua_pop</code></a></h3><p>
3442<span class="apii">[-n, +0, <em>-</em>]</span>
3379<pre>void lua_pop (lua_State *L, int n);</pre>3443<pre>void lua_pop (lua_State *L, int n);</pre>
3380 3444
3381<p>3445<p>
@@ -3385,7 +3449,8 @@ Pops <code>n</code> elements from the stack. · 3 unmodified lines
3385 3449
3386 3450
3387 3451
3388<hr><h3><a name="lua_pushboolean"><code>lua_pushboolean</code></a></h3>3452<hr><h3><a name="lua_pushboolean"><code>lua_pushboolean</code></a></h3><p>
3453<span class="apii">[-0, +1, <em>-</em>]</span>
3389<pre>void lua_pushboolean (lua_State *L, int b);</pre>3454<pre>void lua_pushboolean (lua_State *L, int b);</pre>
3390 3455
3391<p>3456<p>
@@ -3395,7 +3460,8 @@ Pushes a boolean value with value <code>b</code> onto the stack. · 3 unmodified lines
3395 3460
3396 3461
3397 3462
3398<hr><h3><a name="lua_pushcclosure"><code>lua_pushcclosure</code></a></h3>3463<hr><h3><a name="lua_pushcclosure"><code>lua_pushcclosure</code></a></h3><p>
3464<span class="apii">[-n, +1, <em>m</em>]</span>
3399<pre>void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);</pre>3465<pre>void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);</pre>
3400 3466
3401<p>3467<p>
@@ -3420,7 +3486,8 @@ associated with the function. · 18 unmodified lines
3420 3486
3421 3487
3422 3488
3423<hr><h3><a name="lua_pushcfunction"><code>lua_pushcfunction</code></a></h3>3489<hr><h3><a name="lua_pushcfunction"><code>lua_pushcfunction</code></a></h3><p>
3490<span class="apii">[-0, +1, <em>m</em>]</span>
3424<pre>void lua_pushcfunction (lua_State *L, lua_CFunction f);</pre>3491<pre>void lua_pushcfunction (lua_State *L, lua_CFunction f);</pre>
3425 3492
3426<p>3493<p>
@@ -3446,7 +3513,8 @@ and return its results (see <a href="#lua_CFunction"><code>lua_CFunction</code>< · 19 unmodified lines
3446 3513
3447 3514
3448 3515
3449<hr><h3><a name="lua_pushfstring"><code>lua_pushfstring</code></a></h3>3516<hr><h3><a name="lua_pushfstring"><code>lua_pushfstring</code></a></h3><p>
3517<span class="apii">[-0, +1, <em>m</em>]</span>
3450<pre>const char *lua_pushfstring (lua_State *L, const char *fmt, ...);</pre>3518<pre>const char *lua_pushfstring (lua_State *L, const char *fmt, ...);</pre>
3451 3519
3452<p>3520<p>
@@ -3480,7 +3548,8 @@ The conversion specifiers can only be · 27 unmodified lines
3480 3548
3481 3549
3482 3550
3483<hr><h3><a name="lua_pushinteger"><code>lua_pushinteger</code></a></h3>3551<hr><h3><a name="lua_pushinteger"><code>lua_pushinteger</code></a></h3><p>
3552<span class="apii">[-0, +1, <em>-</em>]</span>
3484<pre>void lua_pushinteger (lua_State *L, lua_Integer n);</pre>3553<pre>void lua_pushinteger (lua_State *L, lua_Integer n);</pre>
3485 3554
3486<p>3555<p>
@@ -3490,7 +3559,8 @@ Pushes a number with value <code>n</code> onto the stack. · 3 unmodified lines
3490 3559
3491 3560
3492 3561
3493<hr><h3><a name="lua_pushlightuserdata"><code>lua_pushlightuserdata</code></a></h3>3562<hr><h3><a name="lua_pushlightuserdata"><code>lua_pushlightuserdata</code></a></h3><p>
3563<span class="apii">[-0, +1, <em>-</em>]</span>
3494<pre>void lua_pushlightuserdata (lua_State *L, void *p);</pre>3564<pre>void lua_pushlightuserdata (lua_State *L, void *p);</pre>
3495 3565
3496<p>3566<p>
@@ -3510,7 +3580,8 @@ light userdata with the same C&nbsp;address. · 13 unmodified lines
3510 3580
3511 3581
3512 3582
3513<hr><h3><a name="lua_pushlstring"><code>lua_pushlstring</code></a></h3>3583<hr><h3><a name="lua_pushlstring"><code>lua_pushlstring</code></a></h3><p>
3584<span class="apii">[-0, +1, <em>m</em>]</span>
3514<pre>void lua_pushlstring (lua_State *L, const char *s, size_t len);</pre>3585<pre>void lua_pushlstring (lua_State *L, const char *s, size_t len);</pre>
3515 3586
3516<p>3587<p>
@@ -3525,7 +3596,8 @@ The string can contain embedded zeros. · 8 unmodified lines
3525 3596
3526 3597
3527 3598
3528<hr><h3><a name="lua_pushnil"><code>lua_pushnil</code></a></h3>3599<hr><h3><a name="lua_pushnil"><code>lua_pushnil</code></a></h3><p>
3600<span class="apii">[-0, +1, <em>-</em>]</span>
3529<pre>void lua_pushnil (lua_State *L);</pre>3601<pre>void lua_pushnil (lua_State *L);</pre>
3530 3602
3531<p>3603<p>
@@ -3535,7 +3607,8 @@ Pushes a nil value onto the stack. · 3 unmodified lines
3535 3607
3536 3608
3537 3609
3538<hr><h3><a name="lua_pushnumber"><code>lua_pushnumber</code></a></h3>3610<hr><h3><a name="lua_pushnumber"><code>lua_pushnumber</code></a></h3><p>
3611<span class="apii">[-0, +1, <em>-</em>]</span>
3539<pre>void lua_pushnumber (lua_State *L, lua_Number n);</pre>3612<pre>void lua_pushnumber (lua_State *L, lua_Number n);</pre>
3540 3613
3541<p>3614<p>
@@ -3545,7 +3618,8 @@ Pushes a number with value <code>n</code> onto the stack. · 3 unmodified lines
3545 3618
3546 3619
3547 3620
3548<hr><h3><a name="lua_pushstring"><code>lua_pushstring</code></a></h3>3621<hr><h3><a name="lua_pushstring"><code>lua_pushstring</code></a></h3><p>
3622<span class="apii">[-0, +1, <em>m</em>]</span>
3549<pre>void lua_pushstring (lua_State *L, const char *s);</pre>3623<pre>void lua_pushstring (lua_State *L, const char *s);</pre>
3550 3624
3551<p>3625<p>
@@ -3561,7 +3635,8 @@ it is assumed to end at the first zero. · 9 unmodified lines
3561 3635
3562 3636
3563 3637
3564<hr><h3><a name="lua_pushthread"><code>lua_pushthread</code></a></h3>3638<hr><h3><a name="lua_pushthread"><code>lua_pushthread</code></a></h3><p>
3639<span class="apii">[-0, +1, <em>-</em>]</span>
3565<pre>int lua_pushthread (lua_State *L);</pre>3640<pre>int lua_pushthread (lua_State *L);</pre>
3566 3641
3567<p>3642<p>
@@ -3572,7 +3647,8 @@ Returns 1 if this thread is the main thread of its state. · 4 unmodified lines
3572 3647
3573 3648
3574 3649
3575<hr><h3><a name="lua_pushvalue"><code>lua_pushvalue</code></a></h3>3650<hr><h3><a name="lua_pushvalue"><code>lua_pushvalue</code></a></h3><p>
3651<span class="apii">[-0, +1, <em>-</em>]</span>
3576<pre>void lua_pushvalue (lua_State *L, int index);</pre>3652<pre>void lua_pushvalue (lua_State *L, int index);</pre>
3577 3653
3578<p>3654<p>
@@ -3583,7 +3659,8 @@ onto the stack. · 4 unmodified lines
3583 3659
3584 3660
3585 3661
3586<hr><h3><a name="lua_pushvfstring"><code>lua_pushvfstring</code></a></h3>3662<hr><h3><a name="lua_pushvfstring"><code>lua_pushvfstring</code></a></h3><p>
3663<span class="apii">[-0, +1, <em>m</em>]</span>
3587<pre>const char *lua_pushvfstring (lua_State *L,3664<pre>const char *lua_pushvfstring (lua_State *L,
3588 const char *fmt,3665 const char *fmt,
3589 va_list argp);</pre>3666 va_list argp);</pre>
@@ -3596,7 +3673,8 @@ instead of a variable number of arguments. · 6 unmodified lines
3596 3673
3597 3674
3598 3675
3599<hr><h3><a name="lua_rawequal"><code>lua_rawequal</code></a></h3>3676<hr><h3><a name="lua_rawequal"><code>lua_rawequal</code></a></h3><p>
3677<span class="apii">[-0, +0, <em>-</em>]</span>
3600<pre>int lua_rawequal (lua_State *L, int index1, int index2);</pre>3678<pre>int lua_rawequal (lua_State *L, int index1, int index2);</pre>
3601 3679
3602<p>3680<p>
@@ -3610,7 +3688,8 @@ Also returns&nbsp;0 if any of the indices are non valid. · 7 unmodified lines
3610 3688
3611 3689
3612 3690
3613<hr><h3><a name="lua_rawget"><code>lua_rawget</code></a></h3>3691<hr><h3><a name="lua_rawget"><code>lua_rawget</code></a></h3><p>
3692<span class="apii">[-1, +1, <em>-</em>]</span>
3614<pre>void lua_rawget (lua_State *L, int index);</pre>3693<pre>void lua_rawget (lua_State *L, int index);</pre>
3615 3694
3616<p>3695<p>
@@ -3621,12 +3700,13 @@ Similar to <a href="#lua_gettable"><code>lua_gettable</code></a>, but does a raw · 4 unmodified lines
3621 3700
3622 3701
3623 3702
3624<hr><h3><a name="lua_rawgeti"><code>lua_rawgeti</code></a></h3>3703<hr><h3><a name="lua_rawgeti"><code>lua_rawgeti</code></a></h3><p>
3704<span class="apii">[-0, +1, <em>-</em>]</span>
3625<pre>void lua_rawgeti (lua_State *L, int index, int n);</pre>3705<pre>void lua_rawgeti (lua_State *L, int index, int n);</pre>
3626 3706
3627<p>3707<p>
3628Pushes onto the stack the value <code>t[n]</code>,3708Pushes onto the stack the value <code>t[n]</code>,
3629where <code>t</code> is the value at the given valid index <code>index</code>.3709where <code>t</code> is the value at the given valid index.
3630The access is raw;3710The access is raw;
3631that is, it does not invoke metamethods.3711that is, it does not invoke metamethods.
3632 3712
@@ -3634,7 +3714,8 @@ that is, it does not invoke metamethods. · 1 unmodified line
3634 3714
3635 3715
3636 3716
3637<hr><h3><a name="lua_rawset"><code>lua_rawset</code></a></h3>3717<hr><h3><a name="lua_rawset"><code>lua_rawset</code></a></h3><p>
3718<span class="apii">[-2, +0, <em>m</em>]</span>
3638<pre>void lua_rawset (lua_State *L, int index);</pre>3719<pre>void lua_rawset (lua_State *L, int index);</pre>
3639 3720
3640<p>3721<p>
@@ -3645,13 +3726,14 @@ Similar to <a href="#lua_settable"><code>lua_settable</code></a>, but does a raw · 4 unmodified lines
3645 3726
3646 3727
3647 3728
3648<hr><h3><a name="lua_rawseti"><code>lua_rawseti</code></a></h3>3729<hr><h3><a name="lua_rawseti"><code>lua_rawseti</code></a></h3><p>
3730<span class="apii">[-1, +0, <em>m</em>]</span>
3649<pre>void lua_rawseti (lua_State *L, int index, int n);</pre>3731<pre>void lua_rawseti (lua_State *L, int index, int n);</pre>
3650 3732
3651<p>3733<p>
3652Does the equivalent of <code>t[n] = v</code>,3734Does the equivalent of <code>t[n] = v</code>,
3653where <code>t</code> is the value at the given valid index <code>index</code>3735where <code>t</code> is the value at the given valid index
3654and <code>v</code> is the value at the top of the stack,3736and <code>v</code> is the value at the top of the stack.
3655 3737
3656 3738
3657<p>3739<p>
@@ -3684,7 +3766,8 @@ The reader function may return pieces of any size greater than zero. · 26 unmodified lines
3684 3766
3685 3767
3686 3768
3687<hr><h3><a name="lua_register"><code>lua_register</code></a></h3>3769<hr><h3><a name="lua_register"><code>lua_register</code></a></h3><p>
3770<span class="apii">[-0, +0, <em>m</em>]</span>
3688<pre>void lua_register (lua_State *L,3771<pre>void lua_register (lua_State *L,
3689 const char *name,3772 const char *name,
3690 lua_CFunction f);</pre>3773 lua_CFunction f);</pre>
@@ -3701,7 +3784,8 @@ It is defined as a macro: · 10 unmodified lines
3701 3784
3702 3785
3703 3786
3704<hr><h3><a name="lua_remove"><code>lua_remove</code></a></h3>3787<hr><h3><a name="lua_remove"><code>lua_remove</code></a></h3><p>
3788<span class="apii">[-1, +0, <em>-</em>]</span>
3705<pre>void lua_remove (lua_State *L, int index);</pre>3789<pre>void lua_remove (lua_State *L, int index);</pre>
3706 3790
3707<p>3791<p>
@@ -3714,7 +3798,8 @@ because a pseudo-index is not an actual stack position. · 6 unmodified lines
3714 3798
3715 3799
3716 3800
3717<hr><h3><a name="lua_replace"><code>lua_replace</code></a></h3>3801<hr><h3><a name="lua_replace"><code>lua_replace</code></a></h3><p>
3802<span class="apii">[-1, +0, <em>-</em>]</span>
3718<pre>void lua_replace (lua_State *L, int index);</pre>3803<pre>void lua_replace (lua_State *L, int index);</pre>
3719 3804
3720<p>3805<p>
@@ -3726,7 +3811,8 @@ without shifting any element · 5 unmodified lines
3726 3811
3727 3812
3728 3813
3729<hr><h3><a name="lua_resume"><code>lua_resume</code></a></h3>3814<hr><h3><a name="lua_resume"><code>lua_resume</code></a></h3><p>
3815<span class="apii">[-?, +?, <em>-</em>]</span>
3730<pre>int lua_resume (lua_State *L, int narg);</pre>3816<pre>int lua_resume (lua_State *L, int narg);</pre>
3731 3817
3732<p>3818<p>
@@ -3759,7 +3845,8 @@ and then call <a href="#lua_resume"><code>lua_resume</code></a>. · 26 unmodified lines
3759 3845
3760 3846
3761 3847
3762<hr><h3><a name="lua_setallocf"><code>lua_setallocf</code></a></h3>3848<hr><h3><a name="lua_setallocf"><code>lua_setallocf</code></a></h3><p>
3849<span class="apii">[-0, +0, <em>-</em>]</span>
3763<pre>void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);</pre>3850<pre>void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);</pre>
3764 3851
3765<p>3852<p>
@@ -3770,7 +3857,8 @@ with user data <code>ud</code>. · 4 unmodified lines
3770 3857
3771 3858
3772 3859
3773<hr><h3><a name="lua_setfenv"><code>lua_setfenv</code></a></h3>3860<hr><h3><a name="lua_setfenv"><code>lua_setfenv</code></a></h3><p>
3861<span class="apii">[-1, +0, <em>-</em>]</span>
3774<pre>int lua_setfenv (lua_State *L, int index);</pre>3862<pre>int lua_setfenv (lua_State *L, int index);</pre>
3775 3863
3776<p>3864<p>
@@ -3785,13 +3873,14 @@ Otherwise it returns 1. · 8 unmodified lines
3785 3873
3786 3874
3787 3875
3788<hr><h3><a name="lua_setfield"><code>lua_setfield</code></a></h3>3876<hr><h3><a name="lua_setfield"><code>lua_setfield</code></a></h3><p>
3877<span class="apii">[-1, +0, <em>e</em>]</span>
3789<pre>void lua_setfield (lua_State *L, int index, const char *k);</pre>3878<pre>void lua_setfield (lua_State *L, int index, const char *k);</pre>
3790 3879
3791<p>3880<p>
3792Does the equivalent to <code>t[k] = v</code>,3881Does the equivalent to <code>t[k] = v</code>,
3793where <code>t</code> is the value at the given valid index <code>index</code>3882where <code>t</code> is the value at the given valid index
3794and <code>v</code> is the value at the top of the stack,3883and <code>v</code> is the value at the top of the stack.
3795 3884
3796 3885
3797<p>3886<p>
@@ -3803,7 +3892,8 @@ for the "newindex" event (see <a href="#2.8">&sect;2.8</a>). · 5 unmodified lines
3803 3892
3804 3893
3805 3894
3806<hr><h3><a name="lua_setglobal"><code>lua_setglobal</code></a></h3>3895<hr><h3><a name="lua_setglobal"><code>lua_setglobal</code></a></h3><p>
3896<span class="apii">[-1, +0, <em>e</em>]</span>
3807<pre>void lua_setglobal (lua_State *L, const char *name);</pre>3897<pre>void lua_setglobal (lua_State *L, const char *name);</pre>
3808 3898
3809<p>3899<p>
@@ -3818,7 +3908,8 @@ It is defined as a macro: · 8 unmodified lines
3818 3908
3819 3909
3820 3910
3821<hr><h3><a name="lua_setmetatable"><code>lua_setmetatable</code></a></h3>3911<hr><h3><a name="lua_setmetatable"><code>lua_setmetatable</code></a></h3><p>
3912<span class="apii">[-1, +0, <em>-</em>]</span>
3822<pre>int lua_setmetatable (lua_State *L, int index);</pre>3913<pre>int lua_setmetatable (lua_State *L, int index);</pre>
3823 3914
3824<p>3915<p>
@@ -3830,12 +3921,13 @@ acceptable index. · 5 unmodified lines
3830 3921
3831 3922
3832 3923
3833<hr><h3><a name="lua_settable"><code>lua_settable</code></a></h3>3924<hr><h3><a name="lua_settable"><code>lua_settable</code></a></h3><p>
3925<span class="apii">[-2, +0, <em>e</em>]</span>
3834<pre>void lua_settable (lua_State *L, int index);</pre>3926<pre>void lua_settable (lua_State *L, int index);</pre>
3835 3927
3836<p>3928<p>
3837Does the equivalent to <code>t[k] = v</code>,3929Does the equivalent to <code>t[k] = v</code>,
3838where <code>t</code> is the value at the given valid index <code>index</code>,3930where <code>t</code> is the value at the given valid index,
3839<code>v</code> is the value at the top of the stack,3931<code>v</code> is the value at the top of the stack,
3840and <code>k</code> is the value just below the top.3932and <code>k</code> is the value just below the top.
3841 3933
@@ -3849,7 +3941,8 @@ for the "newindex" event (see <a href="#2.8">&sect;2.8</a>). · 7 unmodified lines
3849 3941
3850 3942
3851 3943
3852<hr><h3><a name="lua_settop"><code>lua_settop</code></a></h3>3944<hr><h3><a name="lua_settop"><code>lua_settop</code></a></h3><p>
3945<span class="apii">[-?, +?, <em>-</em>]</span>
3853<pre>void lua_settop (lua_State *L, int index);</pre>3946<pre>void lua_settop (lua_State *L, int index);</pre>
3854 3947
3855<p>3948<p>
@@ -3882,7 +3975,8 @@ which creates a Lua state from scratch. · 26 unmodified lines
3882 3975
3883 3976
3884 3977
3885<hr><h3><a name="lua_status"><code>lua_status</code></a></h3>3978<hr><h3><a name="lua_status"><code>lua_status</code></a></h3><p>
3979<span class="apii">[-0, +0, <em>-</em>]</span>
3886<pre>int lua_status (lua_State *L);</pre>3980<pre>int lua_status (lua_State *L);</pre>
3887 3981
3888<p>3982<p>
@@ -3898,7 +3992,8 @@ or <a name="pdf-LUA_YIELD"><code>LUA_YIELD</code></a> if the thread is suspended · 9 unmodified lines
3898 3992
3899 3993
3900 3994
3901<hr><h3><a name="lua_toboolean"><code>lua_toboolean</code></a></h3>3995<hr><h3><a name="lua_toboolean"><code>lua_toboolean</code></a></h3><p>
3996<span class="apii">[-0, +0, <em>-</em>]</span>
3902<pre>int lua_toboolean (lua_State *L, int index);</pre>3997<pre>int lua_toboolean (lua_State *L, int index);</pre>
3903 3998
3904<p>3999<p>
@@ -3916,7 +4011,8 @@ use <a href="#lua_isboolean"><code>lua_isboolean</code></a> to test the value's · 11 unmodified lines
3916 4011
3917 4012
3918 4013
3919<hr><h3><a name="lua_tocfunction"><code>lua_tocfunction</code></a></h3>4014<hr><h3><a name="lua_tocfunction"><code>lua_tocfunction</code></a></h3><p>
4015<span class="apii">[-0, +0, <em>-</em>]</span>
3920<pre>lua_CFunction lua_tocfunction (lua_State *L, int index);</pre>4016<pre>lua_CFunction lua_tocfunction (lua_State *L, int index);</pre>
3921 4017
3922<p>4018<p>
@@ -3928,8 +4024,9 @@ otherwise, returns <code>NULL</code>. · 5 unmodified lines
3928 4024
3929 4025
3930 4026
3931<hr><h3><a name="lua_tointeger"><code>lua_tointeger</code></a></h3>4027<hr><h3><a name="lua_tointeger"><code>lua_tointeger</code></a></h3><p>
3932<pre>lua_Integer lua_tointeger (lua_State *L, int idx);</pre>4028<span class="apii">[-0, +0, <em>-</em>]</span>
4029<pre>lua_Integer lua_tointeger (lua_State *L, int index);</pre>
3933 4030
3934<p>4031<p>
3935Converts the Lua value at the given acceptable index4032Converts the Lua value at the given acceptable index
@@ -3947,7 +4044,8 @@ it is truncated in some non-specified way. · 11 unmodified lines
3947 4044
3948 4045
3949 4046
3950<hr><h3><a name="lua_tolstring"><code>lua_tolstring</code></a></h3>4047<hr><h3><a name="lua_tolstring"><code>lua_tolstring</code></a></h3><p>
4048<span class="apii">[-0, +0, <em>m</em>]</span>
3951<pre>const char *lua_tolstring (lua_State *L, int index, size_t *len);</pre>4049<pre>const char *lua_tolstring (lua_State *L, int index, size_t *len);</pre>
3952 4050
3953<p>4051<p>
@@ -3977,7 +4075,8 @@ will be valid after the corresponding value is removed from the stack. · 23 unmodified lines
3977 4075
3978 4076
3979 4077
3980<hr><h3><a name="lua_tonumber"><code>lua_tonumber</code></a></h3>4078<hr><h3><a name="lua_tonumber"><code>lua_tonumber</code></a></h3><p>
4079<span class="apii">[-0, +0, <em>-</em>]</span>
3981<pre>lua_Number lua_tonumber (lua_State *L, int index);</pre>4080<pre>lua_Number lua_tonumber (lua_State *L, int index);</pre>
3982 4081
3983<p>4082<p>
@@ -3991,7 +4090,8 @@ otherwise, <a href="#lua_tonumber"><code>lua_tonumber</code></a> returns&nbsp;0. · 7 unmodified lines
3991 4090
3992 4091
3993 4092
3994<hr><h3><a name="lua_topointer"><code>lua_topointer</code></a></h3>4093<hr><h3><a name="lua_topointer"><code>lua_topointer</code></a></h3><p>
4094<span class="apii">[-0, +0, <em>-</em>]</span>
3995<pre>const void *lua_topointer (lua_State *L, int index);</pre>4095<pre>const void *lua_topointer (lua_State *L, int index);</pre>
3996 4096
3997<p>4097<p>
@@ -4010,7 +4110,8 @@ Typically this function is used only for debug information. · 12 unmodified lines
4010 4110
4011 4111
4012 4112
4013<hr><h3><a name="lua_tostring"><code>lua_tostring</code></a></h3>4113<hr><h3><a name="lua_tostring"><code>lua_tostring</code></a></h3><p>
4114<span class="apii">[-0, +0, <em>m</em>]</span>
4014<pre>const char *lua_tostring (lua_State *L, int index);</pre>4115<pre>const char *lua_tostring (lua_State *L, int index);</pre>
4015 4116
4016<p>4117<p>
@@ -4020,7 +4121,8 @@ Equivalent to <a href="#lua_tolstring"><code>lua_tolstring</code></a> with <code · 3 unmodified lines
4020 4121
4021 4122
4022 4123
4023<hr><h3><a name="lua_tothread"><code>lua_tothread</code></a></h3>4124<hr><h3><a name="lua_tothread"><code>lua_tothread</code></a></h3><p>
4125<span class="apii">[-0, +0, <em>-</em>]</span>
4024<pre>lua_State *lua_tothread (lua_State *L, int index);</pre>4126<pre>lua_State *lua_tothread (lua_State *L, int index);</pre>
4025 4127
4026<p>4128<p>
@@ -4033,7 +4135,8 @@ otherwise, the function returns <code>NULL</code>. · 6 unmodified lines
4033 4135
4034 4136
4035 4137
4036<hr><h3><a name="lua_touserdata"><code>lua_touserdata</code></a></h3>4138<hr><h3><a name="lua_touserdata"><code>lua_touserdata</code></a></h3><p>
4139<span class="apii">[-0, +0, <em>-</em>]</span>
4037<pre>void *lua_touserdata (lua_State *L, int index);</pre>4140<pre>void *lua_touserdata (lua_State *L, int index);</pre>
4038 4141
4039<p>4142<p>
@@ -4047,7 +4150,8 @@ Otherwise, returns <code>NULL</code>. · 7 unmodified lines
4047 4150
4048 4151
4049 4152
4050<hr><h3><a name="lua_type"><code>lua_type</code></a></h3>4153<hr><h3><a name="lua_type"><code>lua_type</code></a></h3><p>
4154<span class="apii">[-0, +0, <em>-</em>]</span>
4051<pre>int lua_type (lua_State *L, int index);</pre>4155<pre>int lua_type (lua_State *L, int index);</pre>
4052 4156
4053<p>4157<p>
@@ -4071,7 +4175,8 @@ and · 17 unmodified lines
4071 4175
4072 4176
4073 4177
4074<hr><h3><a name="lua_typename"><code>lua_typename</code></a></h3>4178<hr><h3><a name="lua_typename"><code>lua_typename</code></a></h3><p>
4179<span class="apii">[-0, +0, <em>-</em>]</span>
4075<pre>const char *lua_typename (lua_State *L, int tp);</pre>4180<pre>const char *lua_typename (lua_State *L, int tp);</pre>
4076 4181
4077<p>4182<p>
@@ -4089,7 +4194,7 @@ which must be one the values returned by <a href="#lua_type"><code>lua_type</cod · 11 unmodified lines
4089 void* ud);</pre>4194 void* ud);</pre>
4090 4195
4091<p>4196<p>
4092The writer function used by <a href="#lua_dump"><code>lua_dump</code></a>.4197The type of the writer function used by <a href="#lua_dump"><code>lua_dump</code></a>.
4093Every time it produces another piece of chunk,4198Every time it produces another piece of chunk,
4094<a href="#lua_dump"><code>lua_dump</code></a> calls the writer,4199<a href="#lua_dump"><code>lua_dump</code></a> calls the writer,
4095passing along the buffer to be written (<code>p</code>),4200passing along the buffer to be written (<code>p</code>),
@@ -4107,7 +4212,8 @@ calling the writer again. · 11 unmodified lines
4107 4212
4108 4213
4109 4214
4110<hr><h3><a name="lua_xmove"><code>lua_xmove</code></a></h3>4215<hr><h3><a name="lua_xmove"><code>lua_xmove</code></a></h3><p>
4216<span class="apii">[-?, +?, <em>-</em>]</span>
4111<pre>void lua_xmove (lua_State *from, lua_State *to, int n);</pre>4217<pre>void lua_xmove (lua_State *from, lua_State *to, int n);</pre>
4112 4218
4113<p>4219<p>
@@ -4122,7 +4228,8 @@ and pushes them onto the stack <code>to</code>. · 8 unmodified lines
4122 4228
4123 4229
4124 4230
4125<hr><h3><a name="lua_yield"><code>lua_yield</code></a></h3>4231<hr><h3><a name="lua_yield"><code>lua_yield</code></a></h3><p>
4232<span class="apii">[-?, +?, <em>-</em>]</span>
4126<pre>int lua_yield (lua_State *L, int nresults);</pre>4233<pre>int lua_yield (lua_State *L, int nresults);</pre>
4127 4234
4128<p>4235<p>
@@ -4254,7 +4361,8 @@ the number of upvalues of the function. · 125 unmodified lines
4254 4361
4255 4362
4256 4363
4257<hr><h3><a name="lua_gethook"><code>lua_gethook</code></a></h3>4364<hr><h3><a name="lua_gethook"><code>lua_gethook</code></a></h3><p>
4365<span class="apii">[-0, +0, <em>-</em>]</span>
4258<pre>lua_Hook lua_gethook (lua_State *L);</pre>4366<pre>lua_Hook lua_gethook (lua_State *L);</pre>
4259 4367
4260<p>4368<p>
@@ -4264,7 +4372,8 @@ Returns the current hook function. · 3 unmodified lines
4264 4372
4265 4373
4266 4374
4267<hr><h3><a name="lua_gethookcount"><code>lua_gethookcount</code></a></h3>4375<hr><h3><a name="lua_gethookcount"><code>lua_gethookcount</code></a></h3><p>
4376<span class="apii">[-0, +0, <em>-</em>]</span>
4268<pre>int lua_gethookcount (lua_State *L);</pre>4377<pre>int lua_gethookcount (lua_State *L);</pre>
4269 4378
4270<p>4379<p>
@@ -4274,7 +4383,8 @@ Returns the current hook count. · 3 unmodified lines
4274 4383
4275 4384
4276 4385
4277<hr><h3><a name="lua_gethookmask"><code>lua_gethookmask</code></a></h3>4386<hr><h3><a name="lua_gethookmask"><code>lua_gethookmask</code></a></h3><p>
4387<span class="apii">[-0, +0, <em>-</em>]</span>
4278<pre>int lua_gethookmask (lua_State *L);</pre>4388<pre>int lua_gethookmask (lua_State *L);</pre>
4279 4389
4280<p>4390<p>
@@ -4284,7 +4394,8 @@ Returns the current hook mask. · 3 unmodified lines
4284 4394
4285 4395
4286 4396
4287<hr><h3><a name="lua_getinfo"><code>lua_getinfo</code></a></h3>4397<hr><h3><a name="lua_getinfo"><code>lua_getinfo</code></a></h3><p>
4398<span class="apii">[-(0|1), +(0|1|2), <em>-</em>]</span>
4288<pre>int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);</pre>4399<pre>int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);</pre>
4289 4400
4290<p>4401<p>
@@ -4357,7 +4468,8 @@ This function returns 0 on error · 66 unmodified lines
4357 4468
4358 4469
4359 4470
4360<hr><h3><a name="lua_getlocal"><code>lua_getlocal</code></a></h3>4471<hr><h3><a name="lua_getlocal"><code>lua_getlocal</code></a></h3><p>
4472<span class="apii">[-0, +(0|1), <em>-</em>]</span>
4361<pre>const char *lua_getlocal (lua_State *L, lua_Debug *ar, int n);</pre>4473<pre>const char *lua_getlocal (lua_State *L, lua_Debug *ar, int n);</pre>
4362 4474
4363<p>4475<p>
@@ -4387,7 +4499,8 @@ the number of active local variables. · 23 unmodified lines
4387 4499
4388 4500
4389 4501
4390<hr><h3><a name="lua_getstack"><code>lua_getstack</code></a></h3>4502<hr><h3><a name="lua_getstack"><code>lua_getstack</code></a></h3><p>
4503<span class="apii">[-0, +0, <em>-</em>]</span>
4391<pre>int lua_getstack (lua_State *L, int level, lua_Debug *ar);</pre>4504<pre>int lua_getstack (lua_State *L, int level, lua_Debug *ar);</pre>
4392 4505
4393<p>4506<p>
@@ -4408,7 +4521,8 @@ it returns 0. · 14 unmodified lines
4408 4521
4409 4522
4410 4523
4411<hr><h3><a name="lua_getupvalue"><code>lua_getupvalue</code></a></h3>4524<hr><h3><a name="lua_getupvalue"><code>lua_getupvalue</code></a></h3><p>
4525<span class="apii">[-0, +(0|1), <em>-</em>]</span>
4412<pre>const char *lua_getupvalue (lua_State *L, int funcindex, int n);</pre>4526<pre>const char *lua_getupvalue (lua_State *L, int funcindex, int n);</pre>
4413 4527
4414<p>4528<p>
@@ -4468,7 +4582,8 @@ this execution occurs without any calls to hooks. · 53 unmodified lines
4468 4582
4469 4583
4470 4584
4471<hr><h3><a name="lua_sethook"><code>lua_sethook</code></a></h3>4585<hr><h3><a name="lua_sethook"><code>lua_sethook</code></a></h3><p>
4586<span class="apii">[-0, +0, <em>-</em>]</span>
4472<pre>int lua_sethook (lua_State *L, lua_Hook f, int mask, int count);</pre>4587<pre>int lua_sethook (lua_State *L, lua_Hook f, int mask, int count);</pre>
4473 4588
4474<p>4589<p>
@@ -4519,7 +4634,8 @@ A hook is disabled by setting <code>mask</code> to zero. · 44 unmodified lines
4519 4634
4520 4635
4521 4636
4522<hr><h3><a name="lua_setlocal"><code>lua_setlocal</code></a></h3>4637<hr><h3><a name="lua_setlocal"><code>lua_setlocal</code></a></h3><p>
4638<span class="apii">[-(0|1), +0, <em>-</em>]</span>
4523<pre>const char *lua_setlocal (lua_State *L, lua_Debug *ar, int n);</pre>4639<pre>const char *lua_setlocal (lua_State *L, lua_Debug *ar, int n);</pre>
4524 4640
4525<p>4641<p>
@@ -4540,7 +4656,8 @@ the number of active local variables. · 14 unmodified lines
4540 4656
4541 4657
4542 4658
4543<hr><h3><a name="lua_setupvalue"><code>lua_setupvalue</code></a></h3>4659<hr><h3><a name="lua_setupvalue"><code>lua_setupvalue</code></a></h3><p>
4660<span class="apii">[-(0|1), +0, <em>-</em>]</span>
4544<pre>const char *lua_setupvalue (lua_State *L, int funcindex, int n);</pre>4661<pre>const char *lua_setupvalue (lua_State *L, int funcindex, int n);</pre>
4545 4662
4546<p>4663<p>
@@ -4590,7 +4707,7 @@ and so they provide nothing that cannot be done with this API. · 43 unmodified lines
4590Several functions in the auxiliary library are used to4707Several functions in the auxiliary library are used to
4591check C&nbsp;function arguments.4708check C&nbsp;function arguments.
4592Their names are always <code>luaL_check*</code> or <code>luaL_opt*</code>.4709Their names are always <code>luaL_check*</code> or <code>luaL_opt*</code>.
4593All of these functions raise an error if the check is not satisfied.4710All of these functions throw an error if the check is not satisfied.
4594Because the error message is formatted for arguments4711Because the error message is formatted for arguments
4595(e.g., "<code>bad argument #1</code>"),4712(e.g., "<code>bad argument #1</code>"),
4596you should not use these functions for other stack values.4713you should not use these functions for other stack values.
@@ -4605,7 +4722,8 @@ in alphabetical order. · 8 unmodified lines
4605 4722
4606 4723
4607 4724
4608<hr><h3><a name="luaL_addchar"><code>luaL_addchar</code></a></h3>4725<hr><h3><a name="luaL_addchar"><code>luaL_addchar</code></a></h3><p>
4726<span class="apii">[-0, +0, <em>m</em>]</span>
4609<pre>void luaL_addchar (luaL_Buffer *B, char c);</pre>4727<pre>void luaL_addchar (luaL_Buffer *B, char c);</pre>
4610 4728
4611<p>4729<p>
@@ -4616,7 +4734,8 @@ Adds the character <code>c</code> to the buffer <code>B</code> · 4 unmodified lines
4616 4734
4617 4735
4618 4736
4619<hr><h3><a name="luaL_addlstring"><code>luaL_addlstring</code></a></h3>4737<hr><h3><a name="luaL_addlstring"><code>luaL_addlstring</code></a></h3><p>
4738<span class="apii">[-0, +0, <em>m</em>]</span>
4620<pre>void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);</pre>4739<pre>void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);</pre>
4621 4740
4622<p>4741<p>
@@ -4629,7 +4748,8 @@ The string may contain embedded zeros. · 6 unmodified lines
4629 4748
4630 4749
4631 4750
4632<hr><h3><a name="luaL_addsize"><code>luaL_addsize</code></a></h3>4751<hr><h3><a name="luaL_addsize"><code>luaL_addsize</code></a></h3><p>
4752<span class="apii">[-0, +0, <em>m</em>]</span>
4633<pre>void luaL_addsize (luaL_Buffer *B, size_t n);</pre>4753<pre>void luaL_addsize (luaL_Buffer *B, size_t n);</pre>
4634 4754
4635<p>4755<p>
@@ -4641,7 +4761,8 @@ buffer area (see <a href="#luaL_prepbuffer"><code>luaL_prepbuffer</code></a>). · 5 unmodified lines
4641 4761
4642 4762
4643 4763
4644<hr><h3><a name="luaL_addstring"><code>luaL_addstring</code></a></h3>4764<hr><h3><a name="luaL_addstring"><code>luaL_addstring</code></a></h3><p>
4765<span class="apii">[-0, +0, <em>m</em>]</span>
4645<pre>void luaL_addstring (luaL_Buffer *B, const char *s);</pre>4766<pre>void luaL_addstring (luaL_Buffer *B, const char *s);</pre>
4646 4767
4647<p>4768<p>
@@ -4654,7 +4775,8 @@ The string may not contain embedded zeros. · 6 unmodified lines
4654 4775
4655 4776
4656 4777
4657<hr><h3><a name="luaL_addvalue"><code>luaL_addvalue</code></a></h3>4778<hr><h3><a name="luaL_addvalue"><code>luaL_addvalue</code></a></h3><p>
4779<span class="apii">[-1, +0, <em>m</em>]</span>
4658<pre>void luaL_addvalue (luaL_Buffer *B);</pre>4780<pre>void luaL_addvalue (luaL_Buffer *B);</pre>
4659 4781
4660<p>4782<p>
@@ -4673,7 +4795,8 @@ which is the value to be added to the buffer. · 12 unmodified lines
4673 4795
4674 4796
4675 4797
4676<hr><h3><a name="luaL_argcheck"><code>luaL_argcheck</code></a></h3>4798<hr><h3><a name="luaL_argcheck"><code>luaL_argcheck</code></a></h3><p>
4799<span class="apii">[-0, +0, <em>v</em>]</span>
4677<pre>void luaL_argcheck (lua_State *L,4800<pre>void luaL_argcheck (lua_State *L,
4678 int cond,4801 int cond,
4679 int narg,4802 int narg,
@@ -4691,7 +4814,8 @@ where <code>func</code> is retrieved from the call stack: · 11 unmodified lines
4691 4814
4692 4815
4693 4816
4694<hr><h3><a name="luaL_argerror"><code>luaL_argerror</code></a></h3>4817<hr><h3><a name="luaL_argerror"><code>luaL_argerror</code></a></h3><p>
4818<span class="apii">[-0, +0, <em>v</em>]</span>
4695<pre>int luaL_argerror (lua_State *L, int narg, const char *extramsg);</pre>4819<pre>int luaL_argerror (lua_State *L, int narg, const char *extramsg);</pre>
4696 4820
4697<p>4821<p>
@@ -4760,7 +4884,8 @@ plus the final string on its top. · 62 unmodified lines
4760 4884
4761 4885
4762 4886
4763<hr><h3><a name="luaL_buffinit"><code>luaL_buffinit</code></a></h3>4887<hr><h3><a name="luaL_buffinit"><code>luaL_buffinit</code></a></h3><p>
4888<span class="apii">[-0, +0, <em>-</em>]</span>
4764<pre>void luaL_buffinit (lua_State *L, luaL_Buffer *B);</pre>4889<pre>void luaL_buffinit (lua_State *L, luaL_Buffer *B);</pre>
4765 4890
4766<p>4891<p>
@@ -4773,7 +4898,8 @@ the buffer must be declared as a variable · 6 unmodified lines
4773 4898
4774 4899
4775 4900
4776<hr><h3><a name="luaL_callmeta"><code>luaL_callmeta</code></a></h3>4901<hr><h3><a name="luaL_callmeta"><code>luaL_callmeta</code></a></h3><p>
4902<span class="apii">[-0, +(0|1), <em>e</em>]</span>
4777<pre>int luaL_callmeta (lua_State *L, int obj, const char *e);</pre>4903<pre>int luaL_callmeta (lua_State *L, int obj, const char *e);</pre>
4778 4904
4779<p>4905<p>
@@ -4793,7 +4919,8 @@ this function returns 0 (without pushing any value on the stack). · 13 unmodified lines
4793 4919
4794 4920
4795 4921
4796<hr><h3><a name="luaL_checkany"><code>luaL_checkany</code></a></h3>4922<hr><h3><a name="luaL_checkany"><code>luaL_checkany</code></a></h3><p>
4923<span class="apii">[-0, +0, <em>v</em>]</span>
4797<pre>void luaL_checkany (lua_State *L, int narg);</pre>4924<pre>void luaL_checkany (lua_State *L, int narg);</pre>
4798 4925
4799<p>4926<p>
@@ -4804,7 +4931,8 @@ of any type (including <b>nil</b>) at position <code>narg</code>. · 4 unmodified lines
4804 4931
4805 4932
4806 4933
4807<hr><h3><a name="luaL_checkint"><code>luaL_checkint</code></a></h3>4934<hr><h3><a name="luaL_checkint"><code>luaL_checkint</code></a></h3><p>
4935<span class="apii">[-0, +0, <em>v</em>]</span>
4808<pre>int luaL_checkint (lua_State *L, int narg);</pre>4936<pre>int luaL_checkint (lua_State *L, int narg);</pre>
4809 4937
4810<p>4938<p>
@@ -4815,7 +4943,8 @@ and returns this number cast to an <code>int</code>. · 4 unmodified lines
4815 4943
4816 4944
4817 4945
4818<hr><h3><a name="luaL_checkinteger"><code>luaL_checkinteger</code></a></h3>4946<hr><h3><a name="luaL_checkinteger"><code>luaL_checkinteger</code></a></h3><p>
4947<span class="apii">[-0, +0, <em>v</em>]</span>
4819<pre>lua_Integer luaL_checkinteger (lua_State *L, int narg);</pre>4948<pre>lua_Integer luaL_checkinteger (lua_State *L, int narg);</pre>
4820 4949
4821<p>4950<p>
@@ -4826,7 +4955,8 @@ and returns this number cast to a <a href="#lua_Integer"><code>lua_Integer</code · 4 unmodified lines
4826 4955
4827 4956
4828 4957
4829<hr><h3><a name="luaL_checklong"><code>luaL_checklong</code></a></h3>4958<hr><h3><a name="luaL_checklong"><code>luaL_checklong</code></a></h3><p>
4959<span class="apii">[-0, +0, <em>v</em>]</span>
4830<pre>long luaL_checklong (lua_State *L, int narg);</pre>4960<pre>long luaL_checklong (lua_State *L, int narg);</pre>
4831 4961
4832<p>4962<p>
@@ -4837,7 +4967,8 @@ and returns this number cast to a <code>long</code>. · 4 unmodified lines
4837 4967
4838 4968
4839 4969
4840<hr><h3><a name="luaL_checklstring"><code>luaL_checklstring</code></a></h3>4970<hr><h3><a name="luaL_checklstring"><code>luaL_checklstring</code></a></h3><p>
4971<span class="apii">[-0, +0, <em>v</em>]</span>
4841<pre>const char *luaL_checklstring (lua_State *L, int narg, size_t *l);</pre>4972<pre>const char *luaL_checklstring (lua_State *L, int narg, size_t *l);</pre>
4842 4973
4843<p>4974<p>
@@ -4847,10 +4978,16 @@ if <code>l</code> is not <code>NULL</code> fills <code>*l</code> · 3 unmodified lines
4847with the string's length.4978with the string's length.
4848 4979
4849 4980
4981<p>
4982This function uses <a href="#lua_tolstring"><code>lua_tolstring</code></a> to get its result,
4983so all conversions and caveats of that function apply here.
4850 4984
4851 4985
4852 4986
4853<hr><h3><a name="luaL_checknumber"><code>luaL_checknumber</code></a></h3>4987
4988
4989<hr><h3><a name="luaL_checknumber"><code>luaL_checknumber</code></a></h3><p>
4990<span class="apii">[-0, +0, <em>v</em>]</span>
4854<pre>lua_Number luaL_checknumber (lua_State *L, int narg);</pre>4991<pre>lua_Number luaL_checknumber (lua_State *L, int narg);</pre>
4855 4992
4856<p>4993<p>
@@ -4861,7 +4998,8 @@ and returns this number. · 4 unmodified lines
4861 4998
4862 4999
4863 5000
4864<hr><h3><a name="luaL_checkoption"><code>luaL_checkoption</code></a></h3>5001<hr><h3><a name="luaL_checkoption"><code>luaL_checkoption</code></a></h3><p>
5002<span class="apii">[-0, +0, <em>v</em>]</span>
4865<pre>int luaL_checkoption (lua_State *L,5003<pre>int luaL_checkoption (lua_State *L,
4866 int narg,5004 int narg,
4867 const char *def,5005 const char *def,
@@ -4891,7 +5029,8 @@ to use strings instead of numbers to select options.) · 23 unmodified lines
4891 5029
4892 5030
4893 5031
4894<hr><h3><a name="luaL_checkstack"><code>luaL_checkstack</code></a></h3>5032<hr><h3><a name="luaL_checkstack"><code>luaL_checkstack</code></a></h3><p>
5033<span class="apii">[-0, +0, <em>v</em>]</span>
4895<pre>void luaL_checkstack (lua_State *L, int sz, const char *msg);</pre>5034<pre>void luaL_checkstack (lua_State *L, int sz, const char *msg);</pre>
4896 5035
4897<p>5036<p>
@@ -4903,7 +5042,8 @@ raising an error if the stack cannot grow to that size. · 5 unmodified lines
4903 5042
4904 5043
4905 5044
4906<hr><h3><a name="luaL_checkstring"><code>luaL_checkstring</code></a></h3>5045<hr><h3><a name="luaL_checkstring"><code>luaL_checkstring</code></a></h3><p>
5046<span class="apii">[-0, +0, <em>v</em>]</span>
4907<pre>const char *luaL_checkstring (lua_State *L, int narg);</pre>5047<pre>const char *luaL_checkstring (lua_State *L, int narg);</pre>
4908 5048
4909<p>5049<p>
@@ -4911,20 +5051,28 @@ Checks whether the function argument <code>narg</code> is a string · 1 unmodified line
4911and returns this string.5051and returns this string.
4912 5052
4913 5053
5054<p>
5055This function uses <a href="#lua_tolstring"><code>lua_tolstring</code></a> to get its result,
5056so all conversions and caveats of that function apply here.
5057
5058
4914 5059
4915 5060
4916 5061
4917<hr><h3><a name="luaL_checktype"><code>luaL_checktype</code></a></h3>5062<hr><h3><a name="luaL_checktype"><code>luaL_checktype</code></a></h3><p>
5063<span class="apii">[-0, +0, <em>v</em>]</span>
4918<pre>void luaL_checktype (lua_State *L, int narg, int t);</pre>5064<pre>void luaL_checktype (lua_State *L, int narg, int t);</pre>
4919 5065
4920<p>5066<p>
4921Checks whether the function argument <code>narg</code> has type <code>t</code>.5067Checks whether the function argument <code>narg</code> has type <code>t</code>.
5068See <a href="#lua_type"><code>lua_type</code></a> for the encoding of types for <code>t</code>.
4922 5069
4923 5070
4924 5071
4925 5072
4926 5073
4927<hr><h3><a name="luaL_checkudata"><code>luaL_checkudata</code></a></h3>5074<hr><h3><a name="luaL_checkudata"><code>luaL_checkudata</code></a></h3><p>
5075<span class="apii">[-0, +0, <em>v</em>]</span>
4928<pre>void *luaL_checkudata (lua_State *L, int narg, const char *tname);</pre>5076<pre>void *luaL_checkudata (lua_State *L, int narg, const char *tname);</pre>
4929 5077
4930<p>5078<p>
@@ -4935,7 +5083,8 @@ of the type <code>tname</code> (see <a href="#luaL_newmetatable"><code>luaL_newm · 4 unmodified lines
4935 5083
4936 5084
4937 5085
4938<hr><h3><a name="luaL_dofile"><code>luaL_dofile</code></a></h3>5086<hr><h3><a name="luaL_dofile"><code>luaL_dofile</code></a></h3><p>
5087<span class="apii">[-0, +?, <em>m</em>]</span>
4939<pre>int luaL_dofile (lua_State *L, const char *filename);</pre>5088<pre>int luaL_dofile (lua_State *L, const char *filename);</pre>
4940 5089
4941<p>5090<p>
@@ -4952,7 +5101,8 @@ or 1 in case of errors. · 10 unmodified lines
4952 5101
4953 5102
4954 5103
4955<hr><h3><a name="luaL_dostring"><code>luaL_dostring</code></a></h3>5104<hr><h3><a name="luaL_dostring"><code>luaL_dostring</code></a></h3><p>
5105<span class="apii">[-0, +?, <em>m</em>]</span>
4956<pre>int luaL_dostring (lua_State *L, const char *str);</pre>5106<pre>int luaL_dostring (lua_State *L, const char *str);</pre>
4957 5107
4958<p>5108<p>
@@ -4969,7 +5119,8 @@ or 1 in case of errors. · 10 unmodified lines
4969 5119
4970 5120
4971 5121
4972<hr><h3><a name="luaL_error"><code>luaL_error</code></a></h3>5122<hr><h3><a name="luaL_error"><code>luaL_error</code></a></h3><p>
5123<span class="apii">[-0, +0, <em>v</em>]</span>
4973<pre>int luaL_error (lua_State *L, const char *fmt, ...);</pre>5124<pre>int luaL_error (lua_State *L, const char *fmt, ...);</pre>
4974 5125
4975<p>5126<p>
@@ -4991,7 +5142,8 @@ as <code>return luaL_error(<em>args</em>)</code>. · 15 unmodified lines
4991 5142
4992 5143
4993 5144
4994<hr><h3><a name="luaL_getmetafield"><code>luaL_getmetafield</code></a></h3>5145<hr><h3><a name="luaL_getmetafield"><code>luaL_getmetafield</code></a></h3><p>
5146<span class="apii">[-0, +(0|1), <em>m</em>]</span>
4995<pre>int luaL_getmetafield (lua_State *L, int obj, const char *e);</pre>5147<pre>int luaL_getmetafield (lua_State *L, int obj, const char *e);</pre>
4996 5148
4997<p>5149<p>
@@ -5005,7 +5157,8 @@ returns 0 and pushes nothing. · 7 unmodified lines
5005 5157
5006 5158
5007 5159
5008<hr><h3><a name="luaL_getmetatable"><code>luaL_getmetatable</code></a></h3>5160<hr><h3><a name="luaL_getmetatable"><code>luaL_getmetatable</code></a></h3><p>
5161<span class="apii">[-0, +1, <em>-</em>]</span>
5009<pre>void luaL_getmetatable (lua_State *L, const char *tname);</pre>5162<pre>void luaL_getmetatable (lua_State *L, const char *tname);</pre>
5010 5163
5011<p>5164<p>
@@ -5016,7 +5169,8 @@ in the registry (see <a href="#luaL_newmetatable"><code>luaL_newmetatable</code> · 4 unmodified lines
5016 5169
5017 5170
5018 5171
5019<hr><h3><a name="luaL_gsub"><code>luaL_gsub</code></a></h3>5172<hr><h3><a name="luaL_gsub"><code>luaL_gsub</code></a></h3><p>
5173<span class="apii">[-0, +1, <em>m</em>]</span>
5020<pre>const char *luaL_gsub (lua_State *L,5174<pre>const char *luaL_gsub (lua_State *L,
5021 const char *s,5175 const char *s,
5022 const char *p,5176 const char *p,
@@ -5032,7 +5186,8 @@ Pushes the resulting string on the stack and returns it. · 9 unmodified lines
5032 5186
5033 5187
5034 5188
5035<hr><h3><a name="luaL_loadbuffer"><code>luaL_loadbuffer</code></a></h3>5189<hr><h3><a name="luaL_loadbuffer"><code>luaL_loadbuffer</code></a></h3><p>
5190<span class="apii">[-0, +1, <em>m</em>]</span>
5036<pre>int luaL_loadbuffer (lua_State *L,5191<pre>int luaL_loadbuffer (lua_State *L,
5037 const char *buff,5192 const char *buff,
5038 size_t sz,5193 size_t sz,
@@ -5053,7 +5208,8 @@ used for debug information and error messages. · 14 unmodified lines
5053 5208
5054 5209
5055 5210
5056<hr><h3><a name="luaL_loadfile"><code>luaL_loadfile</code></a></h3>5211<hr><h3><a name="luaL_loadfile"><code>luaL_loadfile</code></a></h3><p>
5212<span class="apii">[-0, +1, <em>m</em>]</span>
5057<pre>int luaL_loadfile (lua_State *L, const char *filename);</pre>5213<pre>int luaL_loadfile (lua_State *L, const char *filename);</pre>
5058 5214
5059<p>5215<p>
@@ -5079,7 +5235,8 @@ it does not run it. · 19 unmodified lines
5079 5235
5080 5236
5081 5237
5082<hr><h3><a name="luaL_loadstring"><code>luaL_loadstring</code></a></h3>5238<hr><h3><a name="luaL_loadstring"><code>luaL_loadstring</code></a></h3><p>
5239<span class="apii">[-0, +1, <em>m</em>]</span>
5083<pre>int luaL_loadstring (lua_State *L, const char *s);</pre>5240<pre>int luaL_loadstring (lua_State *L, const char *s);</pre>
5084 5241
5085<p>5242<p>
@@ -5100,7 +5257,8 @@ it does not run it. · 14 unmodified lines
5100 5257
5101 5258
5102 5259
5103<hr><h3><a name="luaL_newmetatable"><code>luaL_newmetatable</code></a></h3>5260<hr><h3><a name="luaL_newmetatable"><code>luaL_newmetatable</code></a></h3><p>
5261<span class="apii">[-0, +1, <em>m</em>]</span>
5104<pre>int luaL_newmetatable (lua_State *L, const char *tname);</pre>5262<pre>int luaL_newmetatable (lua_State *L, const char *tname);</pre>
5105 5263
5106<p>5264<p>
@@ -5120,7 +5278,8 @@ with <code>tname</code> in the registry. · 13 unmodified lines
5120 5278
5121 5279
5122 5280
5123<hr><h3><a name="luaL_newstate"><code>luaL_newstate</code></a></h3>5281<hr><h3><a name="luaL_newstate"><code>luaL_newstate</code></a></h3><p>
5282<span class="apii">[-0, +0, <em>-</em>]</span>
5124<pre>lua_State *luaL_newstate (void);</pre>5283<pre>lua_State *luaL_newstate (void);</pre>
5125 5284
5126<p>5285<p>
@@ -5140,7 +5299,8 @@ or <code>NULL</code> if there is a memory allocation error. · 13 unmodified lines
5140 5299
5141 5300
5142 5301
5143<hr><h3><a name="luaL_openlibs"><code>luaL_openlibs</code></a></h3>5302<hr><h3><a name="luaL_openlibs"><code>luaL_openlibs</code></a></h3><p>
5303<span class="apii">[-0, +0, <em>m</em>]</span>
5144<pre>void luaL_openlibs (lua_State *L);</pre>5304<pre>void luaL_openlibs (lua_State *L);</pre>
5145 5305
5146<p>5306<p>
@@ -5150,7 +5310,8 @@ Opens all standard Lua libraries into the given state. · 3 unmodified lines
5150 5310
5151 5311
5152 5312
5153<hr><h3><a name="luaL_optint"><code>luaL_optint</code></a></h3>5313<hr><h3><a name="luaL_optint"><code>luaL_optint</code></a></h3><p>
5314<span class="apii">[-0, +0, <em>v</em>]</span>
5154<pre>int luaL_optint (lua_State *L, int narg, int d);</pre>5315<pre>int luaL_optint (lua_State *L, int narg, int d);</pre>
5155 5316
5156<p>5317<p>
@@ -5164,7 +5325,8 @@ Otherwise, raises an error. · 7 unmodified lines
5164 5325
5165 5326
5166 5327
5167<hr><h3><a name="luaL_optinteger"><code>luaL_optinteger</code></a></h3>5328<hr><h3><a name="luaL_optinteger"><code>luaL_optinteger</code></a></h3><p>
5329<span class="apii">[-0, +0, <em>v</em>]</span>
5168<pre>lua_Integer luaL_optinteger (lua_State *L,5330<pre>lua_Integer luaL_optinteger (lua_State *L,
5169 int narg,5331 int narg,
5170 lua_Integer d);</pre>5332 lua_Integer d);</pre>
@@ -5180,7 +5342,8 @@ Otherwise, raises an error. · 9 unmodified lines
5180 5342
5181 5343
5182 5344
5183<hr><h3><a name="luaL_optlong"><code>luaL_optlong</code></a></h3>5345<hr><h3><a name="luaL_optlong"><code>luaL_optlong</code></a></h3><p>
5346<span class="apii">[-0, +0, <em>v</em>]</span>
5184<pre>long luaL_optlong (lua_State *L, int narg, long d);</pre>5347<pre>long luaL_optlong (lua_State *L, int narg, long d);</pre>
5185 5348
5186<p>5349<p>
@@ -5194,7 +5357,8 @@ Otherwise, raises an error. · 7 unmodified lines
5194 5357
5195 5358
5196 5359
5197<hr><h3><a name="luaL_optlstring"><code>luaL_optlstring</code></a></h3>5360<hr><h3><a name="luaL_optlstring"><code>luaL_optlstring</code></a></h3><p>
5361<span class="apii">[-0, +0, <em>v</em>]</span>
5198<pre>const char *luaL_optlstring (lua_State *L,5362<pre>const char *luaL_optlstring (lua_State *L,
5199 int narg,5363 int narg,
5200 const char *d,5364 const char *d,
@@ -5216,7 +5380,8 @@ fills the position <code>*l</code> with the results's length. · 15 unmodified lines
5216 5380
5217 5381
5218 5382
5219<hr><h3><a name="luaL_optnumber"><code>luaL_optnumber</code></a></h3>5383<hr><h3><a name="luaL_optnumber"><code>luaL_optnumber</code></a></h3><p>
5384<span class="apii">[-0, +0, <em>v</em>]</span>
5220<pre>lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number d);</pre>5385<pre>lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number d);</pre>
5221 5386
5222<p>5387<p>
@@ -5230,7 +5395,8 @@ Otherwise, raises an error. · 7 unmodified lines
5230 5395
5231 5396
5232 5397
5233<hr><h3><a name="luaL_optstring"><code>luaL_optstring</code></a></h3>5398<hr><h3><a name="luaL_optstring"><code>luaL_optstring</code></a></h3><p>
5399<span class="apii">[-0, +0, <em>v</em>]</span>
5234<pre>const char *luaL_optstring (lua_State *L,5400<pre>const char *luaL_optstring (lua_State *L,
5235 int narg,5401 int narg,
5236 const char *d);</pre>5402 const char *d);</pre>
@@ -5246,7 +5412,8 @@ Otherwise, raises an error. · 9 unmodified lines
5246 5412
5247 5413
5248 5414
5249<hr><h3><a name="luaL_prepbuffer"><code>luaL_prepbuffer</code></a></h3>5415<hr><h3><a name="luaL_prepbuffer"><code>luaL_prepbuffer</code></a></h3><p>
5416<span class="apii">[-0, +0, <em>-</em>]</span>
5250<pre>char *luaL_prepbuffer (luaL_Buffer *B);</pre>5417<pre>char *luaL_prepbuffer (luaL_Buffer *B);</pre>
5251 5418
5252<p>5419<p>
@@ -5261,7 +5428,8 @@ it to the buffer. · 8 unmodified lines
5261 5428
5262 5429
5263 5430
5264<hr><h3><a name="luaL_pushresult"><code>luaL_pushresult</code></a></h3>5431<hr><h3><a name="luaL_pushresult"><code>luaL_pushresult</code></a></h3><p>
5432<span class="apii">[-?, +1, <em>m</em>]</span>
5265<pre>void luaL_pushresult (luaL_Buffer *B);</pre>5433<pre>void luaL_pushresult (luaL_Buffer *B);</pre>
5266 5434
5267<p>5435<p>
@@ -5272,7 +5440,8 @@ the top of the stack. · 4 unmodified lines
5272 5440
5273 5441
5274 5442
5275<hr><h3><a name="luaL_ref"><code>luaL_ref</code></a></h3>5443<hr><h3><a name="luaL_ref"><code>luaL_ref</code></a></h3><p>
5444<span class="apii">[-1, +0, <em>m</em>]</span>
5276<pre>int luaL_ref (lua_State *L, int t);</pre>5445<pre>int luaL_ref (lua_State *L, int t);</pre>
5277 5446
5278<p>5447<p>
@@ -5318,7 +5487,8 @@ in which both <code>name</code> and <code>func</code> are <code>NULL</code>. · 39 unmodified lines
5318 5487
5319 5488
5320 5489
5321<hr><h3><a name="luaL_register"><code>luaL_register</code></a></h3>5490<hr><h3><a name="luaL_register"><code>luaL_register</code></a></h3><p>
5491<span class="apii">[-(0|1), +1, <em>m</em>]</span>
5322<pre>void luaL_register (lua_State *L,5492<pre>void luaL_register (lua_State *L,
5323 const char *libname,5493 const char *libname,
5324 const luaL_Reg *l);</pre>5494 const luaL_Reg *l);</pre>
@@ -5352,17 +5522,19 @@ on the top of the stack. · 27 unmodified lines
5352 5522
5353 5523
5354 5524
5355<hr><h3><a name="luaL_typename"><code>luaL_typename</code></a></h3>5525<hr><h3><a name="luaL_typename"><code>luaL_typename</code></a></h3><p>
5356<pre>const char *luaL_typename (lua_State *L, int idx);</pre>5526<span class="apii">[-0, +0, <em>-</em>]</span>
5527<pre>const char *luaL_typename (lua_State *L, int index);</pre>
5357 5528
5358<p>5529<p>
5359Returns the name of the type of the value at index <code>idx</code>.5530Returns the name of the type of the value at the given index.
5360 5531
5361 5532
5362 5533
5363 5534
5364 5535
5365<hr><h3><a name="luaL_typerror"><code>luaL_typerror</code></a></h3>5536<hr><h3><a name="luaL_typerror"><code>luaL_typerror</code></a></h3><p>
5537<span class="apii">[-0, +0, <em>v</em>]</span>
5366<pre>int luaL_typerror (lua_State *L, int narg, const char *tname);</pre>5538<pre>int luaL_typerror (lua_State *L, int narg, const char *tname);</pre>
5367 5539
5368<p>5540<p>
@@ -5379,7 +5551,8 @@ and <code><em>rt</em></code> is the type name of the actual argument. · 10 unmodified lines
5379 5551
5380 5552
5381 5553
5382<hr><h3><a name="luaL_unref"><code>luaL_unref</code></a></h3>5554<hr><h3><a name="luaL_unref"><code>luaL_unref</code></a></h3><p>
5555<span class="apii">[-0, +0, <em>-</em>]</span>
5383<pre>void luaL_unref (lua_State *L, int t, int ref);</pre>5556<pre>void luaL_unref (lua_State *L, int t, int ref);</pre>
5384 5557
5385<p>5558<p>
@@ -5398,7 +5571,8 @@ If <code>ref</code> is <a href="#pdf-LUA_NOREF"><code>LUA_NOREF</code></a> or <a · 12 unmodified lines
5398 5571
5399 5572
5400 5573
5401<hr><h3><a name="luaL_where"><code>luaL_where</code></a></h3>5574<hr><h3><a name="luaL_where"><code>luaL_where</code></a></h3><p>
5575<span class="apii">[-0, +1, <em>m</em>]</span>
5402<pre>void luaL_where (lua_State *L, int lvl);</pre>5576<pre>void luaL_where (lua_State *L, int lvl);</pre>
5403 5577
5404<p>5578<p>
@@ -5433,7 +5607,7 @@ Some of these functions provide essential services to the language · 28 unmodified lines
5433others provide access to "outside" services (e.g., I/O);5607others provide access to "outside" services (e.g., I/O);
5434and others could be implemented in Lua itself,5608and others could be implemented in Lua itself,
5435but are quite useful or have critical performance requirements that5609but are quite useful or have critical performance requirements that
5436deserve an implementation in C (e.g., <code>sort</code>).5610deserve an implementation in C (e.g., <a href="#pdf-table.sort"><code>table.sort</code></a>).
5437 5611
5438 5612
5439<p>5613<p>
@@ -5476,7 +5650,8 @@ it can open them individually by calling · 36 unmodified lines
5476<a name="pdf-luaopen_string"><code>luaopen_string</code></a> (for the string library),5650<a name="pdf-luaopen_string"><code>luaopen_string</code></a> (for the string library),
5477<a name="pdf-luaopen_table"><code>luaopen_table</code></a> (for the table library),5651<a name="pdf-luaopen_table"><code>luaopen_table</code></a> (for the table library),
5478<a name="pdf-luaopen_math"><code>luaopen_math</code></a> (for the mathematical library),5652<a name="pdf-luaopen_math"><code>luaopen_math</code></a> (for the mathematical library),
5479<a name="pdf-luaopen_io"><code>luaopen_io</code></a> (for the I/O and the Operating System libraries),5653<a name="pdf-luaopen_io"><code>luaopen_io</code></a> (for the I/O library),
5654<a name="pdf-luaopen_os"><code>luaopen_os</code></a> (for the Operating System library),
5480and <a name="pdf-luaopen_debug"><code>luaopen_debug</code></a> (for the debug library).5655and <a name="pdf-luaopen_debug"><code>luaopen_debug</code></a> (for the debug library).
5481These functions are declared in <a name="pdf-lualib.h"><code>lualib.h</code></a>5656These functions are declared in <a name="pdf-lualib.h"><code>lualib.h</code></a>
5482and should not be called directly:5657and should not be called directly:
@@ -5665,6 +5840,8 @@ The environment of the returned function is the global environment. · 182 unmodified lines
5665<p>5840<p>
5666<code>chunkname</code> is used as the chunk name for error messages5841<code>chunkname</code> is used as the chunk name for error messages
5667and debug information.5842and debug information.
5843When absent,
5844it defaults to "<code>=(load)</code>".
5668 5845
5669 5846
5670 5847
@@ -5698,6 +5875,11 @@ To load and run a given string, use the idiom · 27 unmodified lines
5698 assert(loadstring(s))()5875 assert(loadstring(s))()
5699</pre>5876</pre>
5700 5877
5878<p>
5879When absent,
5880<code>chunkname</code> defaults to the given string.
5881
5882
5701 5883
5702 5884
5703<p>5885<p>
@@ -6160,7 +6342,15 @@ Otherwise, it tries to find a <em>loader</em> for the module. · 456 unmodified lines
6160 6342
6161<p>6343<p>
6162To find a loader,6344To find a loader,
6163first <code>require</code> queries <code>package.preload[modname]</code>.6345<code>require</code> is guided by the <a href="#pdf-package.loaders"><code>package.loaders</code></a> array.
6346By changing this array,
6347we can change how <code>require</code> looks for a module.
6348The following explanation is based on the default configuration
6349for <a href="#pdf-package.loaders"><code>package.loaders</code></a>.
6350
6351
6352<p>
6353First <code>require</code> queries <code>package.preload[modname]</code>.
6164If it has a value,6354If it has a value,
6165this value (which should be a function) is the loader.6355this value (which should be a function) is the loader.
6166Otherwise <code>require</code> searches for a Lua loader using the6356Otherwise <code>require</code> searches for a Lua loader using the
@@ -6168,38 +6358,7 @@ path stored in <a href="#pdf-package.path"><code>package.path</code></a>. · 1 unmodified line
6168If that also fails, it searches for a C&nbsp;loader using the6358If that also fails, it searches for a C&nbsp;loader using the
6169path stored in <a href="#pdf-package.cpath"><code>package.cpath</code></a>.6359path stored in <a href="#pdf-package.cpath"><code>package.cpath</code></a>.
6170If that also fails,6360If that also fails,
6171it tries an <em>all-in-one</em> loader (see below).6361it tries an <em>all-in-one</em> loader (see <a href="#pdf-package.loaders"><code>package.loaders</code></a>).
6172
6173
6174<p>
6175When loading a C&nbsp;library,
6176<code>require</code> first uses a dynamic link facility to link the
6177application with the library.
6178Then it tries to find a C&nbsp;function inside this library to
6179be used as the loader.
6180The name of this C&nbsp;function is the string "<code>luaopen_</code>"
6181concatenated with a copy of the module name where each dot
6182is replaced by an underscore.
6183Moreover, if the module name has a hyphen,
6184its prefix up to (and including) the first hyphen is removed.
6185For instance, if the module name is <code>a.v1-b.c</code>,
6186the function name will be <code>luaopen_b_c</code>.
6187
6188
6189<p>
6190If <code>require</code> finds neither a Lua library nor a
6191C&nbsp;library for a module,
6192it calls the <em>all-in-one loader</em>.
6193This loader searches the C&nbsp;path for a library for
6194the root name of the given module.
6195For instance, when requiring <code>a.b.c</code>,
6196it will search for a C&nbsp;library for <code>a</code>.
6197If found, it looks into it for an open function for
6198the submodule;
6199in our example, that would be <code>luaopen_a_b_c</code>.
6200With this facility, a package can pack several C&nbsp;submodules
6201into one single library,
6202with each submodule keeping its original open function.
6203 6362
6204 6363
6205<p>6364<p>
@@ -6234,7 +6393,7 @@ The path used by <a href="#pdf-require"><code>require</code></a> to search for a · 28 unmodified lines
6234Lua initializes the C&nbsp;path <a href="#pdf-package.cpath"><code>package.cpath</code></a> in the same way6393Lua initializes the C&nbsp;path <a href="#pdf-package.cpath"><code>package.cpath</code></a> in the same way
6235it initializes the Lua path <a href="#pdf-package.path"><code>package.path</code></a>,6394it initializes the Lua path <a href="#pdf-package.path"><code>package.path</code></a>,
6236using the environment variable <a name="pdf-LUA_CPATH"><code>LUA_CPATH</code></a>6395using the environment variable <a name="pdf-LUA_CPATH"><code>LUA_CPATH</code></a>
6237(plus another default path defined in <code>luaconf.h</code>).6396or a default path defined in <code>luaconf.h</code>.
6238 6397
6239 6398
6240 6399
@@ -6254,6 +6413,94 @@ When you require a module <code>modname</code> and · 13 unmodified lines
6254 6413
6255 6414
6256 6415
6416<p>
6417<hr><h3><a name="pdf-package.loaders"><code>package.loaders</code></a></h3>
6418
6419
6420<p>
6421A table used by <a href="#pdf-require"><code>require</code></a> to control how to load modules.
6422
6423
6424<p>
6425Each entry in this table is a <em>searcher function</em>.
6426When looking for a module,
6427<a href="#pdf-require"><code>require</code></a> calls each of these searchers in ascending order,
6428with the module name (the argument given to <a href="#pdf-require"><code>require</code></a>) as its
6429sole parameter.
6430The function may return another function (the module <em>loader</em>)
6431or a string explaining why it did not find that module
6432(or <b>nil</b> if it has nothing to say).
6433Lua initializes this table with four functions.
6434
6435
6436<p>
6437The first searcher simply looks for a loader in the
6438<a href="#pdf-package.preload"><code>package.preload</code></a> table.
6439
6440
6441<p>
6442The second searcher looks for a loader as a Lua library,
6443using the path stored at <a href="#pdf-package.path"><code>package.path</code></a>.
6444A path is a sequence of <em>templates</em> separated by semicolons.
6445For each template,
6446the searcher will change each interrogation
6447mark in the template by <code>filename</code>,
6448which is the module name with each dot replaced by a
6449"directory separator" (such as "<code>/</code>" in Unix);
6450then it will try to open the resulting file name.
6451So, for instance, if the Lua path is the string
6452
6453<pre>
6454 "./?.lua;./?.lc;/usr/local/?/init.lua"
6455</pre><p>
6456the search for a Lua file for module <code>foo</code>
6457will try to open the files
6458<code>./foo.lua</code>, <code>./foo.lc</code>, and
6459<code>/usr/local/foo/init.lua</code>, in that order.
6460
6461
6462<p>
6463The third searcher looks for a loader as a C&nbsp;library,
6464using the path given by the variable <a href="#pdf-package.cpath"><code>package.cpath</code></a>.
6465For instance,
6466if the C&nbsp;path is the string
6467
6468<pre>
6469 "./?.so;./?.dll;/usr/local/?/init.so"
6470</pre><p>
6471the searcher for module <code>foo</code>
6472will try to open the files <code>./foo.so</code>, <code>./foo.dll</code>,
6473and <code>/usr/local/foo/init.so</code>, in that order.
6474Once it finds a C&nbsp;library,
6475this searcher first uses a dynamic link facility to link the
6476application with the library.
6477Then it tries to find a C&nbsp;function inside the library to
6478be used as the loader.
6479The name of this C&nbsp;function is the string "<code>luaopen_</code>"
6480concatenated with a copy of the module name where each dot
6481is replaced by an underscore.
6482Moreover, if the module name has a hyphen,
6483its prefix up to (and including) the first hyphen is removed.
6484For instance, if the module name is <code>a.v1-b.c</code>,
6485the function name will be <code>luaopen_b_c</code>.
6486
6487
6488<p>
6489The fourth searcher tries an <em>all-in-one loader</em>.
6490It searches the C&nbsp;path for a library for
6491the root name of the given module.
6492For instance, when requiring <code>a.b.c</code>,
6493it will search for a C&nbsp;library for <code>a</code>.
6494If found, it looks into it for an open function for
6495the submodule;
6496in our example, that would be <code>luaopen_a_b_c</code>.
6497With this facility, a package can pack several C&nbsp;submodules
6498into one single library,
6499with each submodule keeping its original open function.
6500
6501
6502
6503
6257<p>6504<p>
6258<hr><h3><a name="pdf-package.loadlib"><code>package.loadlib (libname, funcname)</code></a></h3>6505<hr><h3><a name="pdf-package.loadlib"><code>package.loadlib (libname, funcname)</code></a></h3>
6259 6506
@@ -6303,24 +6550,6 @@ Any "<code>;;</code>" in the value of the environment variable · 43 unmodified lines
6303is replaced by the default path.6550is replaced by the default path.
6304 6551
6305 6552
6306<p>
6307A path is a sequence of <em>templates</em> separated by semicolons.
6308For each template, <a href="#pdf-require"><code>require</code></a> will change each interrogation
6309mark in the template by <code>filename</code>,
6310which is <code>modname</code> with each dot replaced by a
6311"directory separator" (such as "<code>/</code>" in Unix);
6312then it will try to load the resulting file name.
6313So, for instance, if the Lua path is
6314
6315<pre>
6316 "./?.lua;./?.lc;/usr/local/?/init.lua"
6317</pre><p>
6318the search for a Lua loader for module <code>foo</code>
6319will try to load the files
6320<code>./foo.lua</code>, <code>./foo.lc</code>, and
6321<code>/usr/local/foo/init.lua</code>, in that order.
6322
6323
6324 6553
6325 6554
6326<p>6555<p>
@@ -6524,11 +6753,12 @@ work as an anchor, as this would prevent the iteration. · 197 unmodified lines
6524<p>6753<p>
6525<hr><h3><a name="pdf-string.gsub"><code>string.gsub (s, pattern, repl [, n])</code></a></h3>6754<hr><h3><a name="pdf-string.gsub"><code>string.gsub (s, pattern, repl [, n])</code></a></h3>
6526Returns a copy of <code>s</code>6755Returns a copy of <code>s</code>
6527in which all occurrences of the <code>pattern</code> have been6756in which all (or the first <code>n</code>, if given)
6757occurrences of the <code>pattern</code> have been
6528replaced by a replacement string specified by <code>repl</code>,6758replaced by a replacement string specified by <code>repl</code>,
6529which may be a string, a table, or a function.6759which may be a string, a table, or a function.
6530<code>gsub</code> also returns, as its second value,6760<code>gsub</code> also returns, as its second value,
6531the total number of substitutions made.6761the total number of matches that occurred.
6532 6762
6533 6763
6534<p>6764<p>
@@ -6565,13 +6795,6 @@ then there is no replacement · 30 unmodified lines
6565(that is, the original match is kept in the string).6795(that is, the original match is kept in the string).
6566 6796
6567 6797
6568<p>
6569The optional last parameter <code>n</code> limits
6570the maximum number of substitutions to occur.
6571For instance, when <code>n</code> is 1 only the first occurrence of
6572<code>pattern</code> is replaced.
6573
6574
6575<p>6798<p>
6576Here are some examples:6799Here are some examples:
6577 6800
@@ -7005,14 +7228,14 @@ Returns the arc tangent of <code>x</code> (in radians). · 427 unmodified lines
7005 7228
7006 7229
7007<p>7230<p>
7008<hr><h3><a name="pdf-math.atan2"><code>math.atan2 (x, y)</code></a></h3>7231<hr><h3><a name="pdf-math.atan2"><code>math.atan2 (y, x)</code></a></h3>
7009 7232
7010 7233
7011<p>7234<p>
7012Returns the arc tangent of <code>x/y</code> (in radians),7235Returns the arc tangent of <code>y/x</code> (in radians),
7013but uses the signs of both parameters to find the7236but uses the signs of both parameters to find the
7014quadrant of the result.7237quadrant of the result.
7015(It also handles correctly the case of <code>y</code> being zero.)7238(It also handles correctly the case of <code>x</code> being zero.)
7016 7239
7017 7240
7018 7241
@@ -7062,7 +7285,7 @@ Returns the angle <code>x</code> (given in radians) in degrees. · 43 unmodified lines
7062 7285
7063 7286
7064<p>7287<p>
7065Returns the the value <em>e<sup>x</sup></em>.7288Returns the value <em>e<sup>x</sup></em>.
7066 7289
7067 7290
7068 7291
@@ -7215,13 +7438,13 @@ pseudo-random generator function <code>rand</code> provided by ANSI&nbsp;C. · 146 unmodified lines
7215 7438
7216<p>7439<p>
7217When called without arguments,7440When called without arguments,
7218returns a pseudo-random real number7441returns a uniform pseudo-random real number
7219in the range <em>[0,1)</em>. 7442in the range <em>[0,1)</em>.
7220When called with a number <code>m</code>,7443When called with an integer number <code>m</code>,
7221<code>math.random</code> returns7444<code>math.random</code> returns
7222a pseudo-random integer in the range <em>[1, m]</em>.7445a uniform pseudo-random integer in the range <em>[1, m]</em>.
7223When called with two numbers <code>m</code> and <code>n</code>,7446When called with two integer numbers <code>m</code> and <code>n</code>,
7224<code>math.random</code> returns a pseudo-random7447<code>math.random</code> returns a uniform pseudo-random
7225integer in the range <em>[m, n]</em>.7448integer in the range <em>[m, n]</em>.
7226 7449
7227 7450
@@ -7316,6 +7539,7 @@ and then all operations are supplied as methods of the file descriptor. · 88 unmodified lines
7316The table <code>io</code> also provides7539The table <code>io</code> also provides
7317three predefined file descriptors with their usual meanings from C:7540three predefined file descriptors with their usual meanings from C:
7318<a name="pdf-io.stdin"><code>io.stdin</code></a>, <a name="pdf-io.stdout"><code>io.stdout</code></a>, and <a name="pdf-io.stderr"><code>io.stderr</code></a>.7541<a name="pdf-io.stdin"><code>io.stdin</code></a>, <a name="pdf-io.stdout"><code>io.stdout</code></a>, and <a name="pdf-io.stderr"><code>io.stderr</code></a>.
7542The I/O library never closes these files.
7319 7543
7320 7544
7321<p>7545<p>
@@ -7829,9 +8053,9 @@ or <b>nil</b> if the request cannot be honored. · 507 unmodified lines
7829 8053
7830<p>8054<p>
7831If <code>locale</code> is the empty string,8055If <code>locale</code> is the empty string,
7832the current locate is set to an implementation-defined native locale.8056the current locale is set to an implementation-defined native locale.
7833If <code>locate</code> is the string "<code>C</code>",8057If <code>locale</code> is the string "<code>C</code>",
7834the current locate is set to the standard C locale.8058the current locale is set to the standard C locale.
7835 8059
7836 8060
7837<p>8061<p>
@@ -7892,7 +8116,7 @@ and similar tasks, such as profiling. · 54 unmodified lines
7892Please resist the temptation to use them as a8116Please resist the temptation to use them as a
7893usual programming tool:8117usual programming tool:
7894they can be very slow.8118they can be very slow.
7895Moreover, several of its functions8119Moreover, several of these functions
7896violate some assumptions about Lua code8120violate some assumptions about Lua code
7897(e.g., that variables local to a function8121(e.g., that variables local to a function
7898cannot be accessed from outside or8122cannot be accessed from outside or
@@ -7983,7 +8207,8 @@ valid lines. · 84 unmodified lines
7983 8207
7984<p>8208<p>
7985For instance, the expression <code>debug.getinfo(1,"n").name</code> returns8209For instance, the expression <code>debug.getinfo(1,"n").name</code> returns
7986a name of the current function, if a reasonable name can be found,8210a table with a name for the current function,
8211if a reasonable name can be found,
7987and the expression <code>debug.getinfo(print)</code>8212and the expression <code>debug.getinfo(print)</code>
7988returns a table with all available information8213returns a table with all available information
7989about the <a href="#pdf-print"><code>print</code></a> function.8214about the <a href="#pdf-print"><code>print</code></a> function.
@@ -8070,9 +8295,9 @@ The string mask may have the following characters, · 80 unmodified lines
8070with the given meaning:8295with the given meaning:
8071 8296
8072<ul>8297<ul>
8073<li><b><code>"c"</code>:</b> The hook is called every time Lua calls a function;</li>8298<li><b><code>"c"</code>:</b> the hook is called every time Lua calls a function;</li>
8074<li><b><code>"r"</code>:</b> The hook is called every time Lua returns from a function;</li>8299<li><b><code>"r"</code>:</b> the hook is called every time Lua returns from a function;</li>
8075<li><b><code>"l"</code>:</b> The hook is called every time Lua enters a new line of code.</li>8300<li><b><code>"l"</code>:</b> the hook is called every time Lua enters a new line of code.</li>
8076</ul><p>8301</ul><p>
8077With a <code>count</code> different from zero,8302With a <code>count</code> different from zero,
8078the hook is called after every <code>count</code> instructions.8303the hook is called after every <code>count</code> instructions.
@@ -8257,17 +8482,19 @@ then its value is used as the prompt. · 178 unmodified lines
8257Similarly, if the global variable <a name="pdf-_PROMPT2"><code>_PROMPT2</code></a> contains a string,8482Similarly, if the global variable <a name="pdf-_PROMPT2"><code>_PROMPT2</code></a> contains a string,
8258its value is used as the secondary prompt8483its value is used as the secondary prompt
8259(issued during incomplete statements).8484(issued during incomplete statements).
8260Therefore, both prompts can be changed directly on the command line.8485Therefore, both prompts can be changed directly on the command line
8261For instance,8486or in any Lua programs by assigning to <code>_PROMPT</code>.
8487See the next example:
8262 8488
8263<pre>8489<pre>
8264 $ lua -e"_PROMPT='myprompt&gt; '" -i8490 $ lua -e"_PROMPT='myprompt&gt; '" -i
8265</pre><p>8491</pre><p>
8266(the outer pair of quotes is for the shell,8492(The outer pair of quotes is for the shell,
8267the inner pair is for Lua),8493the inner pair is for Lua.)
8268or in any Lua programs by assigning to <code>_PROMPT</code>.8494Note the use of <code>-i</code> to enter interactive mode;
8269Note the use of <code>-i</code> to enter interactive mode; otherwise,8495otherwise,
8270the program would just end silently right after the assignment to <code>_PROMPT</code>.8496the program would just end silently
8497right after the assignment to <code>_PROMPT</code>.
8271 8498
8272 8499
8273<p>8500<p>
@@ -8297,7 +8524,7 @@ is a more portable solution.) · 23 unmodified lines
8297<h1>7 - <a name="7">Incompatibilities with the Previous Version</a></h1>8524<h1>7 - <a name="7">Incompatibilities with the Previous Version</a></h1>
8298 8525
8299<p>8526<p>
8300Here we list the incompatibilities that you may found when moving a program8527Here we list the incompatibilities that you may find when moving a program
8301from Lua&nbsp;5.0 to Lua&nbsp;5.1.8528from Lua&nbsp;5.0 to Lua&nbsp;5.1.
8302You can avoid most of the incompatibilities compiling Lua with8529You can avoid most of the incompatibilities compiling Lua with
8303appropriate options (see file <code>luaconf.h</code>).8530appropriate options (see file <code>luaconf.h</code>).
@@ -8446,29 +8673,29 @@ Here is the complete syntax of Lua in extended BNF. · 142 unmodified lines
8446 8673
8447 block ::= chunk8674 block ::= chunk
8448 8675
8449 stat ::= varlist1 `<b>=</b>&acute; explist1 | 8676 stat ::= varlist `<b>=</b>&acute; explist |
8450 functioncall | 8677 functioncall |
8451 <b>do</b> block <b>end</b> | 8678 <b>do</b> block <b>end</b> |
8452 <b>while</b> exp <b>do</b> block <b>end</b> | 8679 <b>while</b> exp <b>do</b> block <b>end</b> |
8453 <b>repeat</b> block <b>until</b> exp | 8680 <b>repeat</b> block <b>until</b> exp |
8454 <b>if</b> exp <b>then</b> block {<b>elseif</b> exp <b>then</b> block} [<b>else</b> block] <b>end</b> | 8681 <b>if</b> exp <b>then</b> block {<b>elseif</b> exp <b>then</b> block} [<b>else</b> block] <b>end</b> |
8455 <b>for</b> Name `<b>=</b>&acute; exp `<b>,</b>&acute; exp [`<b>,</b>&acute; exp] <b>do</b> block <b>end</b> | 8682 <b>for</b> Name `<b>=</b>&acute; exp `<b>,</b>&acute; exp [`<b>,</b>&acute; exp] <b>do</b> block <b>end</b> |
8456 <b>for</b> namelist <b>in</b> explist1 <b>do</b> block <b>end</b> | 8683 <b>for</b> namelist <b>in</b> explist <b>do</b> block <b>end</b> |
8457 <b>function</b> funcname funcbody | 8684 <b>function</b> funcname funcbody |
8458 <b>local</b> <b>function</b> Name funcbody | 8685 <b>local</b> <b>function</b> Name funcbody |
8459 <b>local</b> namelist [`<b>=</b>&acute; explist1] 8686 <b>local</b> namelist [`<b>=</b>&acute; explist]
8460 8687
8461 laststat ::= <b>return</b> [explist1] | <b>break</b>8688 laststat ::= <b>return</b> [explist] | <b>break</b>
8462 8689
8463 funcname ::= Name {`<b>.</b>&acute; Name} [`<b>:</b>&acute; Name]8690 funcname ::= Name {`<b>.</b>&acute; Name} [`<b>:</b>&acute; Name]
8464 8691
8465 varlist1 ::= var {`<b>,</b>&acute; var}8692 varlist ::= var {`<b>,</b>&acute; var}
8466 8693
8467 var ::= Name | prefixexp `<b>[</b>&acute; exp `<b>]</b>&acute; | prefixexp `<b>.</b>&acute; Name 8694 var ::= Name | prefixexp `<b>[</b>&acute; exp `<b>]</b>&acute; | prefixexp `<b>.</b>&acute; Name
8468 8695
8469 namelist ::= Name {`<b>,</b>&acute; Name}8696 namelist ::= Name {`<b>,</b>&acute; Name}
8470 8697
8471 explist1 ::= {exp `<b>,</b>&acute;} exp8698 explist ::= {exp `<b>,</b>&acute;} exp
8472 8699
8473 exp ::= <b>nil</b> | <b>false</b> | <b>true</b> | Number | String | `<b>...</b>&acute; | function | 8700 exp ::= <b>nil</b> | <b>false</b> | <b>true</b> | Number | String | `<b>...</b>&acute; | function |
8474 prefixexp | tableconstructor | exp binop exp | unop exp 8701 prefixexp | tableconstructor | exp binop exp | unop exp
@@ -8477,13 +8704,13 @@ Here is the complete syntax of Lua in extended BNF. · 2 unmodified lines
8477 8704
8478 functioncall ::= prefixexp args | prefixexp `<b>:</b>&acute; Name args 8705 functioncall ::= prefixexp args | prefixexp `<b>:</b>&acute; Name args
8479 8706
8480 args ::= `<b>(</b>&acute; [explist1] `<b>)</b>&acute; | tableconstructor | String 8707 args ::= `<b>(</b>&acute; [explist] `<b>)</b>&acute; | tableconstructor | String
8481 8708
8482 function ::= <b>function</b> funcbody8709 function ::= <b>function</b> funcbody
8483 8710
8484 funcbody ::= `<b>(</b>&acute; [parlist1] `<b>)</b>&acute; block <b>end</b>8711 funcbody ::= `<b>(</b>&acute; [parlist] `<b>)</b>&acute; block <b>end</b>
8485 8712
8486 parlist1 ::= namelist [`<b>,</b>&acute; `<b>...</b>&acute;] | `<b>...</b>&acute;8713 parlist ::= namelist [`<b>,</b>&acute; `<b>...</b>&acute;] | `<b>...</b>&acute;
8487 8714
8488 tableconstructor ::= `<b>{</b>&acute; [fieldlist] `<b>}</b>&acute;8715 tableconstructor ::= `<b>{</b>&acute; [fieldlist] `<b>}</b>&acute;
8489 8716
@@ -8508,13 +8735,14 @@ Here is the complete syntax of Lua in extended BNF. · 18 unmodified lines
8508 8735
8509 8736
8510 8737
8738
8511<HR>8739<HR>
8512<SMALL>8740<SMALL>
8513Last update:8741Last update:
8514Mon Mar 26 12:59:26 BRT 20078742Thu Jan 17 15:06:18 BRST 2008
8515</SMALL>8743</SMALL>
8516<!--8744<!--
8517Last change: ready for Lua 5.1.28745Last change: revised for Lua 5.1.3
8518-->8746-->
8519 8747
8520</body></html>8748</body></html>
doc/readme.html+2−2
@@ -12,7 +12,7 @@ · 11 unmodified lines
12Documentation12Documentation
13</H1>13</H1>
14 14
15This is the documentation included in the source distribution of Lua 5.1.2.15This is the documentation included in the source distribution of Lua 5.1.3.
16 16
17<UL>17<UL>
18<LI><A HREF="contents.html">Reference manual</A>18<LI><A HREF="contents.html">Reference manual</A>
@@ -33,7 +33,7 @@ especially the · 14 unmodified lines
33<HR>33<HR>
34<SMALL>34<SMALL>
35Last update:35Last update:
36Fri Mar 23 14:19:36 BRT 200736Wed Dec 19 13:59:14 BRST 2007
37</SMALL>37</SMALL>
38 38
39</BODY>39</BODY>
etc/lua.pc+1−1
@@ -5,7 +5,7 @@ · 4 unmodified lines
5# grep '^V=' ../Makefile5# grep '^V=' ../Makefile
6V= 5.16V= 5.1
7# grep '^R=' ../Makefile7# grep '^R=' ../Makefile
8R= 5.1.28R= 5.1.3
9 9
10# grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'10# grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
11prefix= /usr/local11prefix= /usr/local
src/Makefile+1−2
@@ -148,8 +148,7 @@ llex.o: llex.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h ltm.h \ · 147 unmodified lines
148lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h148lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h
149lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \149lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \
150 ltm.h lzio.h lmem.h ldo.h150 ltm.h lzio.h lmem.h ldo.h
151loadlib.o: loadlib.c lauxlib.h lua.h luaconf.h lobject.h llimits.h \151loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h
152 lualib.h
153lobject.o: lobject.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h \152lobject.o: lobject.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h \
154 ltm.h lzio.h lmem.h lstring.h lgc.h lvm.h153 ltm.h lzio.h lmem.h lstring.h lgc.h lvm.h
155lopcodes.o: lopcodes.c lopcodes.h llimits.h lua.h luaconf.h154lopcodes.o: lopcodes.c lopcodes.h llimits.h lua.h luaconf.h
src/lapi.c+7−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lapi.c,v 2.55 2006/06/07 12:37:17 roberto Exp $2** $Id: lapi.c,v 2.55.1.3 2008/01/03 15:20:39 roberto Exp $
3** Lua API3** Lua API
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -123,6 +123,11 @@ LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { · 117 unmodified lines
123}123}
124 124
125 125
126LUA_API void lua_setlevel (lua_State *from, lua_State *to) {
127 to->nCcalls = from->nCcalls;
128}
129
130
126LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {131LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {
127 lua_CFunction old;132 lua_CFunction old;
128 lua_lock(L);133 lua_lock(L);
@@ -749,7 +754,7 @@ LUA_API int lua_setfenv (lua_State *L, int idx) { · 620 unmodified lines
749 res = 0;754 res = 0;
750 break;755 break;
751 }756 }
752 luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1));757 if (res) luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1));
753 L->top--;758 L->top--;
754 lua_unlock(L);759 lua_unlock(L);
755 return res;760 return res;
src/lapi.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lapi.h,v 2.2 2005/04/25 19:24:10 roberto Exp $2** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $
3** Auxiliary functions from Lua API3** Auxiliary functions from Lua API
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lauxlib.c+2−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lauxlib.c,v 1.159 2006/03/21 19:31:09 roberto Exp $2** $Id: lauxlib.c,v 1.159.1.2 2008/01/17 14:04:41 roberto Exp $
3** Auxiliary functions for building Lua libraries3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -244,7 +244,7 @@ LUALIB_API void luaI_openlib (lua_State *L, const char *libname, · 238 unmodified lines
244 if (libname) {244 if (libname) {
245 int size = libsize(l);245 int size = libsize(l);
246 /* check whether lib already exists */246 /* check whether lib already exists */
247 luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", size);247 luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1);
248 lua_getfield(L, -1, libname); /* get _LOADED[libname] */248 lua_getfield(L, -1, libname); /* get _LOADED[libname] */
249 if (!lua_istable(L, -1)) { /* not found? */249 if (!lua_istable(L, -1)) { /* not found? */
250 lua_pop(L, 1); /* remove previous result */250 lua_pop(L, 1); /* remove previous result */
src/lauxlib.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lauxlib.h,v 1.88 2006/04/12 20:31:15 roberto Exp $2** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $
3** Auxiliary functions for building Lua libraries3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lbaselib.c+41−32
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lbaselib.c,v 1.191a 2006/06/02 15:34:00 roberto Exp $2** $Id: lbaselib.c,v 1.191.1.3 2008/01/03 15:20:39 roberto Exp $
3** Basic library3** Basic library
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -477,15 +477,52 @@ static const luaL_Reg base_funcs[] = { · 471 unmodified lines
477** =======================================================477** =======================================================
478*/478*/
479 479
480#define CO_RUN 0 /* running */
481#define CO_SUS 1 /* suspended */
482#define CO_NOR 2 /* 'normal' (it resumed another coroutine) */
483#define CO_DEAD 3
484
485static const char *const statnames[] =
486 {"running", "suspended", "normal", "dead"};
487
488static int costatus (lua_State *L, lua_State *co) {
489 if (L == co) return CO_RUN;
490 switch (lua_status(co)) {
491 case LUA_YIELD:
492 return CO_SUS;
493 case 0: {
494 lua_Debug ar;
495 if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */
496 return CO_NOR; /* it is running */
497 else if (lua_gettop(co) == 0)
498 return CO_DEAD;
499 else
500 return CO_SUS; /* initial state */
501 }
502 default: /* some error occured */
503 return CO_DEAD;
504 }
505}
506
507
508static int luaB_costatus (lua_State *L) {
509 lua_State *co = lua_tothread(L, 1);
510 luaL_argcheck(L, co, 1, "coroutine expected");
511 lua_pushstring(L, statnames[costatus(L, co)]);
512 return 1;
513}
514
515
480static int auxresume (lua_State *L, lua_State *co, int narg) {516static int auxresume (lua_State *L, lua_State *co, int narg) {
481 int status;517 int status = costatus(L, co);
482 if (!lua_checkstack(co, narg))518 if (!lua_checkstack(co, narg))
483 luaL_error(L, "too many arguments to resume");519 luaL_error(L, "too many arguments to resume");
484 if (lua_status(co) == 0 && lua_gettop(co) == 0) {520 if (status != CO_SUS) {
485 lua_pushliteral(L, "cannot resume dead coroutine");521 lua_pushfstring(L, "cannot resume %s coroutine", statnames[status]);
486 return -1; /* error flag */522 return -1; /* error flag */
487 }523 }
488 lua_xmove(L, co, narg);524 lua_xmove(L, co, narg);
525 lua_setlevel(L, co);
489 status = lua_resume(co, narg);526 status = lua_resume(co, narg);
490 if (status == 0 || status == LUA_YIELD) {527 if (status == 0 || status == LUA_YIELD) {
491 int nres = lua_gettop(co);528 int nres = lua_gettop(co);
@@ -556,34 +593,6 @@ static int luaB_yield (lua_State *L) { · 64 unmodified lines
556}593}
557 594
558 595
559static int luaB_costatus (lua_State *L) {
560 lua_State *co = lua_tothread(L, 1);
561 luaL_argcheck(L, co, 1, "coroutine expected");
562 if (L == co) lua_pushliteral(L, "running");
563 else {
564 switch (lua_status(co)) {
565 case LUA_YIELD:
566 lua_pushliteral(L, "suspended");
567 break;
568 case 0: {
569 lua_Debug ar;
570 if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */
571 lua_pushliteral(L, "normal"); /* it is running */
572 else if (lua_gettop(co) == 0)
573 lua_pushliteral(L, "dead");
574 else
575 lua_pushliteral(L, "suspended"); /* initial state */
576 break;
577 }
578 default: /* some error occured */
579 lua_pushliteral(L, "dead");
580 break;
581 }
582 }
583 return 1;
584}
585
586
587static int luaB_corunning (lua_State *L) {596static int luaB_corunning (lua_State *L) {
588 if (lua_pushthread(L))597 if (lua_pushthread(L))
589 return 0; /* main thread is not a coroutine */598 return 0; /* main thread is not a coroutine */
src/lcode.c+2−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lcode.c,v 2.25a 2006/03/21 19:28:49 roberto Exp $2** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $
3** Code generator for Lua3** Code generator for Lua
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -699,7 +699,7 @@ void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { · 693 unmodified lines
699 e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;699 e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;
700 switch (op) {700 switch (op) {
701 case OPR_MINUS: {701 case OPR_MINUS: {
702 if (e->k == VK)702 if (!isnumeral(e))
703 luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */703 luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
704 codearith(fs, OP_UNM, e, &e2);704 codearith(fs, OP_UNM, e, &e2);
705 break;705 break;
src/lcode.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lcode.h,v 1.48 2006/03/21 19:28:03 roberto Exp $2** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $
3** Code generator for Lua3** Code generator for Lua
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/ldblib.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: ldblib.c,v 1.104 2005/12/29 15:32:11 roberto Exp $2** $Id: ldblib.c,v 1.104.1.1 2007/12/27 13:02:25 roberto Exp $
3** Interface from Lua to its debug API3** Interface from Lua to its debug API
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/ldebug.c+3−3
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: ldebug.c,v 2.29a 2005/12/22 16:19:56 roberto Exp $2** $Id: ldebug.c,v 2.29.1.3 2007/12/28 15:32:23 roberto Exp $
3** Debug Interface3** Debug Interface
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -563,8 +563,8 @@ void luaG_typeerror (lua_State *L, const TValue *o, const char *op) { · 557 unmodified lines
563 563
564 564
565void luaG_concaterror (lua_State *L, StkId p1, StkId p2) {565void luaG_concaterror (lua_State *L, StkId p1, StkId p2) {
566 if (ttisstring(p1)) p1 = p2;566 if (ttisstring(p1) || ttisnumber(p1)) p1 = p2;
567 lua_assert(!ttisstring(p1));567 lua_assert(!ttisstring(p1) && !ttisnumber(p1));
568 luaG_typeerror(L, p1, "concatenate");568 luaG_typeerror(L, p1, "concatenate");
569}569}
570 570
src/ldebug.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: ldebug.h,v 2.3 2005/04/25 19:24:10 roberto Exp $2** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $
3** Auxiliary functions from Debug Interface module3** Auxiliary functions from Debug Interface module
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/ldo.c+12−10
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: ldo.c,v 2.38 2006/06/05 19:36:14 roberto Exp $2** $Id: ldo.c,v 2.38.1.2 2008/01/03 15:20:39 roberto Exp $
3** Stack and Call structure of Lua3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -83,7 +83,7 @@ static void resetstack (lua_State *L, int status) { · 77 unmodified lines
83 L->base = L->ci->base;83 L->base = L->ci->base;
84 luaF_close(L, L->base); /* close eventual pending closures */84 luaF_close(L, L->base); /* close eventual pending closures */
85 luaD_seterrorobj(L, status, L->base);85 luaD_seterrorobj(L, status, L->base);
86 L->nCcalls = 0;86 L->nCcalls = L->baseCcalls;
87 L->allowhook = 1;87 L->allowhook = 1;
88 restore_stack_limit(L);88 restore_stack_limit(L);
89 L->errfunc = 0;89 L->errfunc = 0;
@@ -417,22 +417,24 @@ static int resume_error (lua_State *L, const char *msg) { · 327 unmodified lines
417LUA_API int lua_resume (lua_State *L, int nargs) {417LUA_API int lua_resume (lua_State *L, int nargs) {
418 int status;418 int status;
419 lua_lock(L);419 lua_lock(L);
420 if (L->status != LUA_YIELD) {420 if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci))
421 if (L->status != 0)
422 return resume_error(L, "cannot resume dead coroutine");
423 else if (L->ci != L->base_ci)
424 return resume_error(L, "cannot resume non-suspended coroutine");421 return resume_error(L, "cannot resume non-suspended coroutine");
425 }422 if (L->nCcalls >= LUAI_MAXCCALLS)
423 return resume_error(L, "C stack overflow");
426 luai_userstateresume(L, nargs);424 luai_userstateresume(L, nargs);
427 lua_assert(L->errfunc == 0 && L->nCcalls == 0);425 lua_assert(L->errfunc == 0);
426 L->baseCcalls = ++L->nCcalls;
428 status = luaD_rawrunprotected(L, resume, L->top - nargs);427 status = luaD_rawrunprotected(L, resume, L->top - nargs);
429 if (status != 0) { /* error? */428 if (status != 0) { /* error? */
430 L->status = cast_byte(status); /* mark thread as `dead' */429 L->status = cast_byte(status); /* mark thread as `dead' */
431 luaD_seterrorobj(L, status, L->top);430 luaD_seterrorobj(L, status, L->top);
432 L->ci->top = L->top;431 L->ci->top = L->top;
433 }432 }
434 else433 else {
434 lua_assert(L->nCcalls == L->baseCcalls);
435 status = L->status;435 status = L->status;
436 }
437 --L->nCcalls;
436 lua_unlock(L);438 lua_unlock(L);
437 return status;439 return status;
438}440}
@@ -441,7 +443,7 @@ LUA_API int lua_resume (lua_State *L, int nargs) { · 2 unmodified lines
441LUA_API int lua_yield (lua_State *L, int nresults) {443LUA_API int lua_yield (lua_State *L, int nresults) {
442 luai_userstateyield(L, nresults);444 luai_userstateyield(L, nresults);
443 lua_lock(L);445 lua_lock(L);
444 if (L->nCcalls > 0)446 if (L->nCcalls > L->baseCcalls)
445 luaG_runerror(L, "attempt to yield across metamethod/C-call boundary");447 luaG_runerror(L, "attempt to yield across metamethod/C-call boundary");
446 L->base = L->top - nresults; /* protect stack slots below */448 L->base = L->top - nresults; /* protect stack slots below */
447 L->status = LUA_YIELD;449 L->status = LUA_YIELD;
src/ldo.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: ldo.h,v 2.7 2005/08/24 16:15:49 roberto Exp $2** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $
3** Stack and Call structure of Lua3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/ldump.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: ldump.c,v 1.15 2006/02/16 15:53:49 lhf Exp $2** $Id: ldump.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $
3** save precompiled Lua chunks3** save precompiled Lua chunks
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lfunc.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lfunc.c,v 2.12a 2005/12/22 16:19:56 roberto Exp $2** $Id: lfunc.c,v 2.12.1.2 2007/12/28 14:58:43 roberto Exp $
3** Auxiliary functions to manipulate prototypes and closures3** Auxiliary functions to manipulate prototypes and closures
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lfunc.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lfunc.h,v 2.4 2005/04/25 19:24:10 roberto Exp $2** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $
3** Auxiliary functions to manipulate prototypes and closures3** Auxiliary functions to manipulate prototypes and closures
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lgc.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lgc.c,v 2.38 2006/05/24 14:34:06 roberto Exp $2** $Id: lgc.c,v 2.38.1.1 2007/12/27 13:02:25 roberto Exp $
3** Garbage Collector3** Garbage Collector
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lgc.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lgc.h,v 2.15 2005/08/24 16:15:49 roberto Exp $2** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $
3** Garbage Collector3** Garbage Collector
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/linit.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: linit.c,v 1.14 2005/12/29 15:32:11 roberto Exp $2** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $
3** Initialization of libraries for lua.c3** Initialization of libraries for lua.c
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/liolib.c+7−5
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: liolib.c,v 2.73 2006/05/08 20:14:16 roberto Exp $2** $Id: liolib.c,v 2.73.1.2 2008/01/02 13:56:00 roberto Exp $
3** Standard I/O (and system) library3** Standard I/O (and system) library
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -106,8 +106,11 @@ static int io_pclose (lua_State *L) { · 100 unmodified lines
106 106
107static int io_fclose (lua_State *L) {107static int io_fclose (lua_State *L) {
108 FILE **p = topfile(L);108 FILE **p = topfile(L);
109 int ok = (fclose(*p) == 0);109 int ok = 0;
110 *p = NULL;110 if (*p != stdin && *p != stdout && *p != stderr) {
111 ok = (fclose(*p) == 0);
112 *p = NULL;
113 }
111 return pushresult(L, ok, NULL);114 return pushresult(L, ok, NULL);
112}115}
113 116
@@ -129,8 +132,7 @@ static int io_close (lua_State *L) { · 15 unmodified lines
129 132
130static int io_gc (lua_State *L) {133static int io_gc (lua_State *L) {
131 FILE *f = *topfile(L);134 FILE *f = *topfile(L);
132 /* ignore closed files and standard files */135 if (f != NULL) /* ignore closed files */
133 if (f != NULL && f != stdin && f != stdout && f != stderr)
134 aux_close(L);136 aux_close(L);
135 return 0;137 return 0;
136}138}
src/llex.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: llex.c,v 2.20 2006/03/09 18:14:31 roberto Exp $2** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $
3** Lexical Analyzer3** Lexical Analyzer
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/llex.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: llex.h,v 1.58 2006/03/23 18:23:32 roberto Exp $2** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $
3** Lexical Analyzer3** Lexical Analyzer
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/llimits.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: llimits.h,v 1.69 2005/12/27 17:12:00 roberto Exp $2** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $
3** Limits, basic types, and some other `installation-dependent' definitions3** Limits, basic types, and some other `installation-dependent' definitions
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lmathlib.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lmathlib.c,v 1.67 2005/08/26 17:36:32 roberto Exp $2** $Id: lmathlib.c,v 1.67.1.1 2007/12/27 13:02:25 roberto Exp $
3** Standard mathematical library3** Standard mathematical library
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lmem.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lmem.c,v 1.70 2005/12/26 13:35:47 roberto Exp $2** $Id: lmem.c,v 1.70.1.1 2007/12/27 13:02:25 roberto Exp $
3** Interface to Memory Manager3** Interface to Memory Manager
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lmem.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lmem.h,v 1.31 2005/04/25 19:24:10 roberto Exp $2** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $
3** Interface to Memory Manager3** Interface to Memory Manager
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/loadlib.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: loadlib.c,v 1.54a 2006/07/03 20:16:49 roberto Exp $2** $Id: loadlib.c,v 1.52.1.2 2007/12/28 14:58:43 roberto Exp $
3** Dynamic library loader for Lua3** Dynamic library loader for Lua
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5**5**
src/lobject.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lobject.c,v 2.22 2006/02/10 17:43:52 roberto Exp $2** $Id: lobject.c,v 2.22.1.1 2007/12/27 13:02:25 roberto Exp $
3** Some generic functions over Lua objects3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lobject.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lobject.h,v 2.20 2006/01/18 11:37:34 roberto Exp $2** $Id: lobject.h,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $
3** Type definitions for Lua objects3** Type definitions for Lua objects
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lopcodes.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lopcodes.c,v 1.37 2005/11/08 19:45:36 roberto Exp $2** $Id: lopcodes.c,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $
3** See Copyright Notice in lua.h3** See Copyright Notice in lua.h
4*/4*/
5 5
src/lopcodes.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lopcodes.h,v 1.125 2006/03/14 19:04:44 roberto Exp $2** $Id: lopcodes.h,v 1.125.1.1 2007/12/27 13:02:25 roberto Exp $
3** Opcodes for Lua virtual machine3** Opcodes for Lua virtual machine
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/loslib.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: loslib.c,v 1.20 2006/09/19 13:57:08 roberto Exp $2** $Id: loslib.c,v 1.19.1.2 2007/12/28 14:58:43 roberto Exp $
3** Standard Operating System library3** Standard Operating System library
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lparser.c+3−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lparser.c,v 2.42a 2006/06/05 15:57:59 roberto Exp $2** $Id: lparser.c,v 2.42.1.3 2007/12/28 15:32:23 roberto Exp $
3** Lua Parser3** Lua Parser
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -938,6 +938,8 @@ static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { · 932 unmodified lines
938 primaryexp(ls, &nv.v);938 primaryexp(ls, &nv.v);
939 if (nv.v.k == VLOCAL)939 if (nv.v.k == VLOCAL)
940 check_conflict(ls, lh, &nv.v);940 check_conflict(ls, lh, &nv.v);
941 luaY_checklimit(ls->fs, nvars, LUAI_MAXCCALLS - ls->L->nCcalls,
942 "variables in assignment");
941 assignment(ls, &nv, nvars+1);943 assignment(ls, &nv, nvars+1);
942 }944 }
943 else { /* assignment -> `=' explist1 */945 else { /* assignment -> `=' explist1 */
src/lparser.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lparser.h,v 1.57 2006/03/09 18:14:31 roberto Exp $2** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $
3** Lua Parser3** Lua Parser
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lstate.c+3−3
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lstate.c,v 2.36 2006/05/24 14:15:50 roberto Exp $2** $Id: lstate.c,v 2.36.1.2 2008/01/03 15:20:39 roberto Exp $
3** Global State3** Global State
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -93,7 +93,7 @@ static void preinit_state (lua_State *L, global_State *g) { · 87 unmodified lines
93 resethookcount(L);93 resethookcount(L);
94 L->openupval = NULL;94 L->openupval = NULL;
95 L->size_ci = 0;95 L->size_ci = 0;
96 L->nCcalls = 0;96 L->nCcalls = L->baseCcalls = 0;
97 L->status = 0;97 L->status = 0;
98 L->base_ci = L->ci = NULL;98 L->base_ci = L->ci = NULL;
99 L->savedpc = NULL;99 L->savedpc = NULL;
@@ -205,7 +205,7 @@ LUA_API void lua_close (lua_State *L) { · 105 unmodified lines
205 do { /* repeat until no more errors */205 do { /* repeat until no more errors */
206 L->ci = L->base_ci;206 L->ci = L->base_ci;
207 L->base = L->top = L->ci->base;207 L->base = L->top = L->ci->base;
208 L->nCcalls = 0;208 L->nCcalls = L->baseCcalls = 0;
209 } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0);209 } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0);
210 lua_assert(G(L)->tmudata == NULL);210 lua_assert(G(L)->tmudata == NULL);
211 luai_userstateclose(L);211 luai_userstateclose(L);
src/lstate.h+2−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lstate.h,v 2.24 2006/02/06 18:27:59 roberto Exp $2** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $
3** Global State3** Global State
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -112,6 +112,7 @@ struct lua_State { · 106 unmodified lines
112 int stacksize;112 int stacksize;
113 int size_ci; /* size of array `base_ci' */113 int size_ci; /* size of array `base_ci' */
114 unsigned short nCcalls; /* number of nested C calls */114 unsigned short nCcalls; /* number of nested C calls */
115 unsigned short baseCcalls; /* nested C calls when resuming coroutine */
115 lu_byte hookmask;116 lu_byte hookmask;
116 lu_byte allowhook;117 lu_byte allowhook;
117 int basehookcount;118 int basehookcount;
src/lstring.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lstring.c,v 2.8 2005/12/22 16:19:56 roberto Exp $2** $Id: lstring.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $
3** String table (keeps all strings handled by Lua)3** String table (keeps all strings handled by Lua)
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lstring.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lstring.h,v 1.43 2005/04/25 19:24:10 roberto Exp $2** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $
3** String table (keep all strings handled by Lua)3** String table (keep all strings handled by Lua)
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lstrlib.c+5−5
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lstrlib.c,v 1.132a 2006/04/26 20:41:19 roberto Exp $2** $Id: lstrlib.c,v 1.132.1.3 2007/12/28 15:32:23 roberto Exp $
3** Standard library for string operations and pattern-matching3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -629,10 +629,6 @@ static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, · 623 unmodified lines
629 lua_gettable(L, 3);629 lua_gettable(L, 3);
630 break;630 break;
631 }631 }
632 default: {
633 luaL_argerror(L, 3, "string/function/table expected");
634 return;
635 }
636 }632 }
637 if (!lua_toboolean(L, -1)) { /* nil or false? */633 if (!lua_toboolean(L, -1)) { /* nil or false? */
638 lua_pop(L, 1);634 lua_pop(L, 1);
@@ -648,11 +644,15 @@ static int str_gsub (lua_State *L) { · 9 unmodified lines
648 size_t srcl;644 size_t srcl;
649 const char *src = luaL_checklstring(L, 1, &srcl);645 const char *src = luaL_checklstring(L, 1, &srcl);
650 const char *p = luaL_checkstring(L, 2);646 const char *p = luaL_checkstring(L, 2);
647 int tr = lua_type(L, 3);
651 int max_s = luaL_optint(L, 4, srcl+1);648 int max_s = luaL_optint(L, 4, srcl+1);
652 int anchor = (*p == '^') ? (p++, 1) : 0;649 int anchor = (*p == '^') ? (p++, 1) : 0;
653 int n = 0;650 int n = 0;
654 MatchState ms;651 MatchState ms;
655 luaL_Buffer b;652 luaL_Buffer b;
653 luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING ||
654 tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3,
655 "string/function/table expected");
656 luaL_buffinit(L, &b);656 luaL_buffinit(L, &b);
657 ms.L = L;657 ms.L = L;
658 ms.src_init = src;658 ms.src_init = src;
src/ltable.c+3−3
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: ltable.c,v 2.32 2006/01/18 11:49:02 roberto Exp $2** $Id: ltable.c,v 2.32.1.2 2007/12/28 15:32:23 roberto Exp $
3** Lua tables (hash)3** Lua tables (hash)
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -84,8 +84,8 @@ static const Node dummynode_ = { · 78 unmodified lines
84static Node *hashnum (const Table *t, lua_Number n) {84static Node *hashnum (const Table *t, lua_Number n) {
85 unsigned int a[numints];85 unsigned int a[numints];
86 int i;86 int i;
87 n += 1; /* normalize number (avoid -0) */87 if (luai_numeq(n, 0)) /* avoid problems with -0 */
88 lua_assert(sizeof(a) <= sizeof(n));88 return gnode(t, 0);
89 memcpy(a, &n, sizeof(a));89 memcpy(a, &n, sizeof(a));
90 for (i = 1; i < numints; i++) a[0] += a[i];90 for (i = 1; i < numints; i++) a[0] += a[i];
91 return hashmod(t, a[0]);91 return hashmod(t, a[0]);
src/ltable.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: ltable.h,v 2.10 2006/01/10 13:13:06 roberto Exp $2** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $
3** Lua tables (hash)3** Lua tables (hash)
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/ltablib.c+3−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: ltablib.c,v 1.38 2005/10/23 17:38:15 roberto Exp $2** $Id: ltablib.c,v 1.38.1.2 2007/12/28 15:32:23 roberto Exp $
3** Library for Table Manipulation3** Library for Table Manipulation
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -118,7 +118,8 @@ static int tinsert (lua_State *L) { · 112 unmodified lines
118static int tremove (lua_State *L) {118static int tremove (lua_State *L) {
119 int e = aux_getn(L, 1);119 int e = aux_getn(L, 1);
120 int pos = luaL_optint(L, 2, e);120 int pos = luaL_optint(L, 2, e);
121 if (e == 0) return 0; /* table is `empty' */121 if (!(1 <= pos && pos <= e)) /* position is outside bounds? */
122 return 0; /* nothing to remove */
122 luaL_setn(L, 1, e - 1); /* t.n = n-1 */123 luaL_setn(L, 1, e - 1); /* t.n = n-1 */
123 lua_rawgeti(L, 1, pos); /* result = t[pos] */124 lua_rawgeti(L, 1, pos); /* result = t[pos] */
124 for ( ;pos<e; pos++) {125 for ( ;pos<e; pos++) {
src/ltm.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: ltm.c,v 2.8 2006/01/10 12:50:00 roberto Exp $2** $Id: ltm.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $
3** Tag methods3** Tag methods
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/ltm.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: ltm.h,v 2.6 2005/06/06 13:30:25 roberto Exp $2** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $
3** Tag methods3** Tag methods
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lua.c+4−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lua.c,v 1.160 2006/06/02 15:34:00 roberto Exp $2** $Id: lua.c,v 1.160.1.2 2007/12/28 15:32:23 roberto Exp $
3** Lua stand-alone interpreter3** Lua stand-alone interpreter
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -74,6 +74,8 @@ static int report (lua_State *L, int status) { · 68 unmodified lines
74 74
75 75
76static int traceback (lua_State *L) {76static int traceback (lua_State *L) {
77 if (!lua_isstring(L, 1)) /* 'message' not a string? */
78 return 1; /* keep it intact */
77 lua_getfield(L, LUA_GLOBALSINDEX, "debug");79 lua_getfield(L, LUA_GLOBALSINDEX, "debug");
78 if (!lua_istable(L, -1)) {80 if (!lua_istable(L, -1)) {
79 lua_pop(L, 1);81 lua_pop(L, 1);
@@ -144,7 +146,7 @@ static int dostring (lua_State *L, const char *s, const char *name) { · 64 unmodified lines
144static int dolibrary (lua_State *L, const char *name) {146static int dolibrary (lua_State *L, const char *name) {
145 lua_getglobal(L, "require");147 lua_getglobal(L, "require");
146 lua_pushstring(L, name);148 lua_pushstring(L, name);
147 return report(L, lua_pcall(L, 1, 0, 0));149 return report(L, docall(L, 1, 1));
148}150}
149 151
150 152
src/lua.h+7−4
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lua.h,v 1.218a 2006/06/02 15:34:00 roberto Exp $2** $Id: lua.h,v 1.218.1.4 2008/01/03 15:41:15 roberto Exp $
3** Lua - An Extensible Extension Language3** Lua - An Extensible Extension Language
4** Lua.org, PUC-Rio, Brazil (http://www.lua.org)4** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
5** See Copyright Notice at the end of this file5** See Copyright Notice at the end of this file
@@ -17,9 +17,9 @@ · 11 unmodified lines
17 17
18 18
19#define LUA_VERSION "Lua 5.1"19#define LUA_VERSION "Lua 5.1"
20#define LUA_RELEASE "Lua 5.1.2"20#define LUA_RELEASE "Lua 5.1.3"
21#define LUA_VERSION_NUM 50121#define LUA_VERSION_NUM 501
22#define LUA_COPYRIGHT "Copyright (C) 1994-2007 Lua.org, PUC-Rio"22#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio"
23#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"23#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
24 24
25 25
@@ -294,6 +294,9 @@ LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); · 268 unmodified lines
294#define lua_Chunkwriter lua_Writer294#define lua_Chunkwriter lua_Writer
295 295
296 296
297/* hack */
298LUA_API void lua_setlevel (lua_State *from, lua_State *to);
299
297 300
298/*301/*
299** {======================================================================302** {======================================================================
@@ -359,7 +362,7 @@ struct lua_Debug { · 59 unmodified lines
359 362
360 363
361/******************************************************************************364/******************************************************************************
362* Copyright (C) 1994-2007 Lua.org, PUC-Rio. All rights reserved.365* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved.
363*366*
364* Permission is hereby granted, free of charge, to any person obtaining367* Permission is hereby granted, free of charge, to any person obtaining
365* a copy of this software and associated documentation files (the368* a copy of this software and associated documentation files (the
src/luaconf.h+3−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: luaconf.h,v 1.82a 2006/04/10 18:27:23 roberto Exp $2** $Id: luaconf.h,v 1.82.1.5 2008/01/17 14:04:20 roberto Exp $
3** Configuration file for Lua3** Configuration file for Lua
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -442,7 +442,8 @@ · 436 unmodified lines
442** functions. This limit is arbitrary; its only purpose is to stop C442** functions. This limit is arbitrary; its only purpose is to stop C
443** functions to consume unlimited stack space.443** functions to consume unlimited stack space.
444*/444*/
445#define LUAI_MAXCSTACK 2048445#define LUAI_MCS_AUX ((int)(INT_MAX / (4*sizeof(LUA_NUMBER))))
446#define LUAI_MAXCSTACK (LUAI_MCS_AUX > SHRT_MAX ? SHRT_MAX : LUAI_MCS_AUX)
446 447
447 448
448 449
src/lualib.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lualib.h,v 1.36 2005/12/27 17:12:00 roberto Exp $2** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $
3** Lua standard libraries3** Lua standard libraries
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lundump.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lundump.c,v 1.60 2006/02/16 15:53:49 lhf Exp $2** $Id: lundump.c,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $
3** load precompiled Lua chunks3** load precompiled Lua chunks
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lundump.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lundump.h,v 1.40 2005/11/11 14:03:13 lhf Exp $2** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $
3** load precompiled Lua chunks3** load precompiled Lua chunks
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lvm.c+4−6
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lvm.c,v 2.63a 2006/06/05 15:58:59 roberto Exp $2** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $
3** Lua virtual machine3** Lua virtual machine
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -61,11 +61,9 @@ static void traceexec (lua_State *L, const Instruction *pc) { · 55 unmodified lines
61 lu_byte mask = L->hookmask;61 lu_byte mask = L->hookmask;
62 const Instruction *oldpc = L->savedpc;62 const Instruction *oldpc = L->savedpc;
63 L->savedpc = pc;63 L->savedpc = pc;
64 if (mask > LUA_MASKLINE) { /* instruction-hook set? */64 if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) {
65 if (L->hookcount == 0) {65 resethookcount(L);
66 resethookcount(L);66 luaD_callhook(L, LUA_HOOKCOUNT, -1);
67 luaD_callhook(L, LUA_HOOKCOUNT, -1);
68 }
69 }67 }
70 if (mask & LUA_MASKLINE) {68 if (mask & LUA_MASKLINE) {
71 Proto *p = ci_func(L->ci)->l.p;69 Proto *p = ci_func(L->ci)->l.p;
src/lvm.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lvm.h,v 2.5 2005/08/22 18:54:49 roberto Exp $2** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $
3** Lua virtual machine3** Lua virtual machine
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lzio.c+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lzio.c,v 1.31 2005/06/03 20:15:29 roberto Exp $2** $Id: lzio.c,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $
3** a generic input stream interface3** a generic input stream interface
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
src/lzio.h+1−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lzio.h,v 1.21 2005/05/17 19:49:15 roberto Exp $2** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $
3** Buffered streams3** Buffered streams
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/