diff options
Diffstat (limited to 'doc/faq.html')
| -rw-r--r-- | doc/faq.html | 195 |
1 files changed, 0 insertions, 195 deletions
diff --git a/doc/faq.html b/doc/faq.html deleted file mode 100644 index a53a7512..00000000 --- a/doc/faq.html +++ /dev/null | |||
| @@ -1,195 +0,0 @@ | |||
| 1 | <!DOCTYPE html> | ||
| 2 | <html> | ||
| 3 | <head> | ||
| 4 | <title>Frequently Asked Questions (FAQ)</title> | ||
| 5 | <meta charset="utf-8"> | ||
| 6 | <meta name="Copyright" content="Copyright (C) 2005-2023"> | ||
| 7 | <meta name="Language" content="en"> | ||
| 8 | <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen"> | ||
| 9 | <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print"> | ||
| 10 | <style type="text/css"> | ||
| 11 | dd { margin-left: 1.5em; } | ||
| 12 | </style> | ||
| 13 | </head> | ||
| 14 | <body> | ||
| 15 | <div id="site"> | ||
| 16 | <a href="https://luajit.org"><span>Lua<span id="logo">JIT</span></span></a> | ||
| 17 | </div> | ||
| 18 | <div id="head"> | ||
| 19 | <h1>Frequently Asked Questions (FAQ)</h1> | ||
| 20 | </div> | ||
| 21 | <div id="nav"> | ||
| 22 | <ul><li> | ||
| 23 | <a href="luajit.html">LuaJIT</a> | ||
| 24 | <ul><li> | ||
| 25 | <a href="https://luajit.org/download.html">Download <span class="ext">»</span></a> | ||
| 26 | </li><li> | ||
| 27 | <a href="install.html">Installation</a> | ||
| 28 | </li><li> | ||
| 29 | <a href="running.html">Running</a> | ||
| 30 | </li></ul> | ||
| 31 | </li><li> | ||
| 32 | <a href="extensions.html">Extensions</a> | ||
| 33 | <ul><li> | ||
| 34 | <a href="ext_ffi.html">FFI Library</a> | ||
| 35 | <ul><li> | ||
| 36 | <a href="ext_ffi_tutorial.html">FFI Tutorial</a> | ||
| 37 | </li><li> | ||
| 38 | <a href="ext_ffi_api.html">ffi.* API</a> | ||
| 39 | </li><li> | ||
| 40 | <a href="ext_ffi_semantics.html">FFI Semantics</a> | ||
| 41 | </li></ul> | ||
| 42 | </li><li> | ||
| 43 | <a href="ext_buffer.html">String Buffers</a> | ||
| 44 | </li><li> | ||
| 45 | <a href="ext_jit.html">jit.* Library</a> | ||
| 46 | </li><li> | ||
| 47 | <a href="ext_c_api.html">Lua/C API</a> | ||
| 48 | </li><li> | ||
| 49 | <a href="ext_profiler.html">Profiler</a> | ||
| 50 | </li></ul> | ||
| 51 | </li><li> | ||
| 52 | <a href="status.html">Status</a> | ||
| 53 | </li><li> | ||
| 54 | <a class="current" href="faq.html">FAQ</a> | ||
| 55 | </li><li> | ||
| 56 | <a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a> | ||
| 57 | </li></ul> | ||
| 58 | </div> | ||
| 59 | <div id="main"> | ||
| 60 | <dl id="info"> | ||
| 61 | <dt>Q: Where can I learn more about LuaJIT and Lua?</dt> | ||
| 62 | <dd> | ||
| 63 | <ul style="padding: 0;"> | ||
| 64 | <li>The <a href="https://luajit.org/list.html"><span class="ext">»</span> LuaJIT mailing list</a> focuses on topics | ||
| 65 | related to LuaJIT.</li> | ||
| 66 | <li>News about Lua itself can be found at the | ||
| 67 | <a href="https://www.lua.org/lua-l.html"><span class="ext">»</span> Lua mailing list</a>. | ||
| 68 | The mailing list archives are worth checking out for older postings | ||
| 69 | about LuaJIT.</li> | ||
| 70 | <li>The <a href="https://lua.org"><span class="ext">»</span> main Lua.org site</a> has complete | ||
| 71 | <a href="https://www.lua.org/docs.html"><span class="ext">»</span> documentation</a> of the language | ||
| 72 | and links to books and papers about Lua.</li> | ||
| 73 | <li>The community-managed <a href="http://lua-users.org/wiki/"><span class="ext">»</span> Lua Wiki</a> | ||
| 74 | has information about diverse topics.</li> | ||
| 75 | </ul></dd> | ||
| 76 | </dl> | ||
| 77 | |||
| 78 | <dl id="tech"> | ||
| 79 | <dt>Q: Where can I learn more about the compiler technology used by LuaJIT?</dt> | ||
| 80 | <dd> | ||
| 81 | Please use the following Google Scholar searches to find relevant papers:<br> | ||
| 82 | Search for: <a href="https://scholar.google.com/scholar?q=Trace+Compiler"><span class="ext">»</span> Trace Compiler</a><br> | ||
| 83 | Search for: <a href="https://scholar.google.com/scholar?q=JIT+Compiler"><span class="ext">»</span> JIT Compiler</a><br> | ||
| 84 | Search for: <a href="https://scholar.google.com/scholar?q=Dynamic+Language+Optimizations"><span class="ext">»</span> Dynamic Language Optimizations</a><br> | ||
| 85 | Search for: <a href="https://scholar.google.com/scholar?q=SSA+Form"><span class="ext">»</span> SSA Form</a><br> | ||
| 86 | Search for: <a href="https://scholar.google.com/scholar?q=Linear+Scan+Register+Allocation"><span class="ext">»</span> Linear Scan Register Allocation</a><br> | ||
| 87 | Here is a list of the <a href="http://lua-users.org/lists/lua-l/2009-11/msg00089.html"><span class="ext">»</span> innovative features in LuaJIT</a>.<br> | ||
| 88 | And, you know, reading the source is of course the only way to enlightenment. | ||
| 89 | </dd> | ||
| 90 | </dl> | ||
| 91 | |||
| 92 | <dl id="arg"> | ||
| 93 | <dt>Q: Why do I get this error: "attempt to index global 'arg' (a nil value)"?<br> | ||
| 94 | Q: My vararg functions fail after switching to LuaJIT!</dt> | ||
| 95 | <dd>LuaJIT is compatible to the Lua 5.1 language standard. It doesn't | ||
| 96 | support the implicit <tt>arg</tt> parameter for old-style vararg | ||
| 97 | functions from Lua 5.0.<br>Please convert your code to the | ||
| 98 | <a href="https://www.lua.org/manual/5.1/manual.html#2.5.9"><span class="ext">»</span> Lua 5.1 | ||
| 99 | vararg syntax</a>.</dd> | ||
| 100 | </dl> | ||
| 101 | |||
| 102 | <dl id="x87"> | ||
| 103 | <dt>Q: Why do I get this error: "bad FPU precision"?<br> | ||
| 104 | <dt>Q: I get weird behavior after initializing Direct3D.<br> | ||
| 105 | <dt>Q: Some FPU operations crash after I load a Delphi DLL.<br> | ||
| 106 | </dt> | ||
| 107 | <dd> | ||
| 108 | |||
| 109 | DirectX/Direct3D (up to version 9) sets the x87 FPU to single-precision | ||
| 110 | mode by default. This violates the Windows ABI and interferes with the | ||
| 111 | operation of many programs — LuaJIT is affected, too. Please make | ||
| 112 | sure you always use the <tt>D3DCREATE_FPU_PRESERVE</tt> flag when | ||
| 113 | initializing Direct3D.<br> | ||
| 114 | |||
| 115 | Direct3D version 10 or higher do not show this behavior anymore. | ||
| 116 | Consider testing your application with older versions, too.<br> | ||
| 117 | |||
| 118 | Similarly, the Borland/Delphi runtime modifies the FPU control word and | ||
| 119 | enables FP exceptions. Of course, this violates the Windows ABI, too. | ||
| 120 | Please check the Delphi docs for the Set8087CW method.</dd> | ||
| 121 | </dl> | ||
| 122 | |||
| 123 | <dl id="ctrlc"> | ||
| 124 | <dt>Q: Sometimes Ctrl-C fails to stop my Lua program. Why?</dt> | ||
| 125 | <dd>The interrupt signal handler sets a Lua debug hook. But this is | ||
| 126 | ignored by compiled code. If your program is running in a tight loop | ||
| 127 | and never falls back to the interpreter, the debug hook never runs and | ||
| 128 | can't throw the "interrupted!" error.<br> | ||
| 129 | You have to press Ctrl-C twice to stop your program. That's similar | ||
| 130 | to when it's stuck running inside a C function under the Lua interpreter.</dd> | ||
| 131 | </dl> | ||
| 132 | |||
| 133 | <dl id="order"> | ||
| 134 | <dt>Q: Table iteration with <tt>pairs()</tt> does not result in the same order?</dt> | ||
| 135 | <dd>The order of table iteration is explicitly <b>undefined</b> by | ||
| 136 | the Lua language standard.<br> | ||
| 137 | Different Lua implementations or versions may use different orders for | ||
| 138 | otherwise identical tables. Different ways of constructing a table may | ||
| 139 | result in different orders, too.<br> | ||
| 140 | Due to improved VM security, LuaJIT 2.1 may even use a different order | ||
| 141 | on separate VM invocations or when string keys are newly interned.<br><br> | ||
| 142 | If your program relies on a deterministic order, it has a bug. Rewrite it, | ||
| 143 | so it doesn't rely on the key order. Or sort the table keys, if you must.</dd> | ||
| 144 | </dl> | ||
| 145 | |||
| 146 | <dl id="sandbox"> | ||
| 147 | <dt>Q: Can Lua code be safely sandboxed?</dt> | ||
| 148 | <dd> | ||
| 149 | Maybe for an extremely restricted subset of Lua and if you relentlessly | ||
| 150 | scrutinize every single interface function you offer to the untrusted code.<br> | ||
| 151 | |||
| 152 | Although Lua provides some sandboxing functionality (<tt>setfenv()</tt>, hooks), | ||
| 153 | it's very hard to get this right even for the Lua core libraries. Of course, | ||
| 154 | you'll need to inspect any extension library, too. And there are libraries | ||
| 155 | that are inherently unsafe, e.g. the <a href="ext_ffi.html">FFI library</a>.<br> | ||
| 156 | |||
| 157 | More reading material at the <a href="http://lua-users.org/wiki/SandBoxes"><span class="ext">»</span> Lua Wiki</a> and <a href="https://en.wikipedia.org/wiki/Sandbox_(computer_security)"><span class="ext">»</span> Wikipedia</a>.<br><br> | ||
| 158 | |||
| 159 | Relatedly, <b>loading untrusted bytecode is not safe!</b><br> | ||
| 160 | |||
| 161 | It's trivial to crash the Lua or LuaJIT VM with maliciously crafted bytecode. | ||
| 162 | This is well known and there's no bytecode verification on purpose, so please | ||
| 163 | don't report a bug about it. Check the <tt>mode</tt> parameter for the | ||
| 164 | <tt>load*()</tt> functions to disable loading of bytecode.<br><br> | ||
| 165 | |||
| 166 | <b>In general, the only promising approach is to sandbox Lua code at the | ||
| 167 | process level and not the VM level.</b> | ||
| 168 | </dd> | ||
| 169 | </dl> | ||
| 170 | |||
| 171 | <dl id="arch"> | ||
| 172 | <dt>Q: Lua runs everywhere. Why doesn't LuaJIT support my CPU?</dt> | ||
| 173 | <dd>Because it's a compiler — it needs to generate native | ||
| 174 | machine code. This means the code generator must be ported to each | ||
| 175 | architecture. And the fast interpreter is written in assembler and | ||
| 176 | must be ported, too. This is quite an undertaking.<br> | ||
| 177 | The <a href="install.html">install documentation</a> shows the supported | ||
| 178 | architectures.<br> | ||
| 179 | Other architectures may follow based on sufficient user demand and | ||
| 180 | market-relevance of the architecture. Sponsoring is required to develop | ||
| 181 | the port itself, to integrate it and to continuously maintain it in the | ||
| 182 | actively developed branches.</dd> | ||
| 183 | </dl> | ||
| 184 | <br class="flush"> | ||
| 185 | </div> | ||
| 186 | <div id="foot"> | ||
| 187 | <hr class="hide"> | ||
| 188 | Copyright © 2005-2023 | ||
| 189 | <span class="noprint"> | ||
| 190 | · | ||
| 191 | <a href="contact.html">Contact</a> | ||
| 192 | </span> | ||
| 193 | </div> | ||
| 194 | </body> | ||
| 195 | </html> | ||
