aboutsummaryrefslogtreecommitdiff
path: root/doc/extensions.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/extensions.html')
-rw-r--r--doc/extensions.html70
1 files changed, 67 insertions, 3 deletions
diff --git a/doc/extensions.html b/doc/extensions.html
index a5baf11c..0679921a 100644
--- a/doc/extensions.html
+++ b/doc/extensions.html
@@ -37,6 +37,8 @@ td.excinterop {
37<ul><li> 37<ul><li>
38<a href="luajit.html">LuaJIT</a> 38<a href="luajit.html">LuaJIT</a>
39<ul><li> 39<ul><li>
40<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
41</li><li>
40<a href="install.html">Installation</a> 42<a href="install.html">Installation</a>
41</li><li> 43</li><li>
42<a href="running.html">Running</a> 44<a href="running.html">Running</a>
@@ -67,8 +69,6 @@ td.excinterop {
67</li><li> 69</li><li>
68<a href="http://luajit.org/performance.html">Performance <span class="ext">&raquo;</span></a> 70<a href="http://luajit.org/performance.html">Performance <span class="ext">&raquo;</span></a>
69</li><li> 71</li><li>
70<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
71</li><li>
72<a href="http://wiki.luajit.org/">Wiki <span class="ext">&raquo;</span></a> 72<a href="http://wiki.luajit.org/">Wiki <span class="ext">&raquo;</span></a>
73</li><li> 73</li><li>
74<a href="http://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a> 74<a href="http://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
@@ -90,7 +90,7 @@ or LuaJIT.
90</p> 90</p>
91<p> 91<p>
92LuaJIT extends the standard Lua VM with new functionality and adds 92LuaJIT extends the standard Lua VM with new functionality and adds
93several extension modules. Please note that this page is only about 93several extension modules. Please note this page is only about
94<em>functional</em> enhancements and not about performance enhancements, 94<em>functional</em> enhancements and not about performance enhancements,
95such as the optimized VM, the faster interpreter or the JIT compiler. 95such as the optimized VM, the faster interpreter or the JIT compiler.
96</p> 96</p>
@@ -236,6 +236,70 @@ across arbitrary C&nbsp;functions. Keep this in mind when
236upgrading from LuaJIT 1.x. 236upgrading from LuaJIT 1.x.
237</p> 237</p>
238 238
239<h2 id="lua52">Extensions from Lua 5.2</h2>
240<p>
241LuaJIT supports some language and library extensions from Lua&nbsp;5.2.
242Features that are unlikely to break existing code are unconditionally
243enabled:
244</p>
245<ul>
246<li><tt>goto</tt> and <tt>::labels::</tt>.</li>
247<li>Hex escapes <tt>'\x3F'</tt> and <tt>'\*'</tt> escape in strings.</li>
248<li><tt>load(string|reader, chunkname [,mode [,env]])</tt>.
249<tt>loadstring()</tt> is an alias.</li>
250<li><tt>math.log(x [,base])</tt>.
251<li><tt>string.rep(s, n [,sep])</tt>.
252<li><tt>string.format()</tt>: <tt>%q</tt> reversible.
253<tt>%s</tt> checks <tt>__tostring</tt>.
254<tt>%a</tt> and <tt>"%A</tt> added.</li>
255<li>String matching pattern <tt>%g</tt> added.</li>
256<li><tt>io.read("*L")</tt>.</li>
257<li><tt>io.lines()</tt> and <tt>file:lines()</tt> process
258<tt>io.read()</tt> options.</li>
259<li><tt>os.exit(status|true|false [,close])</tt>.</li>
260<li><tt>package.searchpath(name, path [, sep [, rep]])</tt>.</li>
261<li><tt>package.loadlib(name, "*")</tt>.</li>
262<li><tt>debug.getinfo()</tt> returns <tt>nparams</tt> and <tt>isvararg</tt>
263for option <tt>"u"</tt>.</li>
264<li><tt>debug.getlocal()</tt> accepts function instead of level.</li>
265<li><tt>debug.getlocal()</tt> and <tt>debug.setlocal()</tt> accept negative
266indexes for varargs.</li>
267<li><tt>debug.getupvalue()</tt> and <tt>debug.setupvalue()</tt> handle
268C&nbsp;functions.</li>
269<li><tt>debug.upvalueid()</tt> and <tt>debug.upvaluejoin()</tt>.</li>
270<li>Command line option <tt>-E</tt>.</li>
271<li>Command line checks <tt>__tostring</tt> for errors.</li>
272</ul>
273<p>
274Other features are only enabled, if LuaJIT is built with
275<tt>-DLUAJIT_ENABLE_LUA52COMPAT</tt>:
276</p>
277<ul>
278<li><tt>goto</tt> is a keyword and not a valid variable name anymore.</li>
279<li><tt>break</tt> can be placed anywhere. Empty statements (<tt>;;</tt>)
280are allowed.</li>
281<li><tt>__lt</tt>, <tt>__le</tt> are invoked for mixed types.</li>
282<li><tt>__len</tt> for tables. <tt>rawlen()</tt> library function.</li>
283<li><tt>pairs()</tt> and <tt>ipairs()</tt> check for <tt>__pairs</tt> and
284<tt>__ipairs</tt>.</li>
285<li><tt>coroutine.running()</tt> returns two results.</li>
286<li><tt>table.pack()</tt> and <tt>table.unpack()</tt>
287(same as <tt>unpack()</tt>).</li>
288<li><tt>io.write()</tt> and <tt>file:write()</tt> return file handle
289instead of <tt>true</tt>.</li>
290<li><tt>os.execute()</tt> and <tt>pipe:close()</tt> return detailed
291exit status.</li>
292<li><tt>debug.setmetatable()</tt> returns object.</li>
293<li><tt>debug.getuservalue()</tt> and <tt>debug.setuservalue()</tt>.</li>
294<li>Remove <tt>math.mod()</tt>, <tt>string.gfind()</tt>.
295</ul>
296<p>
297Note: this provides only partial compatibility with Lua 5.2 at the
298language and Lua library level. LuaJIT is API+ABI-compatible with
299Lua&nbsp;5.1, which prevents implementing features that would otherwise
300break the Lua/C API and ABI (e.g. <tt>_ENV</tt>).
301</p>
302
239<h2 id="exceptions">C++ Exception Interoperability</h2> 303<h2 id="exceptions">C++ Exception Interoperability</h2>
240<p> 304<p>
241LuaJIT has built-in support for interoperating with C++&nbsp;exceptions. 305LuaJIT has built-in support for interoperating with C++&nbsp;exceptions.