diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/running.html | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/doc/running.html b/doc/running.html index cf1bdc45..109df5df 100644 --- a/doc/running.html +++ b/doc/running.html | |||
@@ -118,28 +118,56 @@ are accepted: | |||
118 | <li><tt>-l</tt> — Only list bytecode.</li> | 118 | <li><tt>-l</tt> — Only list bytecode.</li> |
119 | <li><tt>-s</tt> — Strip debug info (this is the default).</li> | 119 | <li><tt>-s</tt> — Strip debug info (this is the default).</li> |
120 | <li><tt>-g</tt> — Keep debug info.</li> | 120 | <li><tt>-g</tt> — Keep debug info.</li> |
121 | <li><tt>-n name</tt> — Set module name (default: auto-detect from input name)</li> | ||
122 | <li><tt>-t type</tt> — Set output file type (default: auto-detect from output name).</li> | ||
123 | <li><tt>-a arch</tt> — Override architecture for object files (default: native).</li> | ||
124 | <li><tt>-o os</tt> — Override OS for object files (default: native).</li> | ||
121 | <li><tt>-e chunk</tt> — Use chunk string as input.</li> | 125 | <li><tt>-e chunk</tt> — Use chunk string as input.</li> |
122 | <li><tt>-</tt> (a single minus sign) — Use stdin as input and/or stdout as output.</li> | 126 | <li><tt>-</tt> (a single minus sign) — Use stdin as input and/or stdout as output.</li> |
123 | </ul> | 127 | </ul> |
124 | <p> | 128 | <p> |
129 | The output file type is auto-detected from the extension of the output | ||
130 | file name: | ||
131 | </p> | ||
132 | <ul> | ||
133 | <li><tt>c</tt> — C source file, exported bytecode data.</li> | ||
134 | <li><tt>h</tt> — C header file, static bytecode data.</li> | ||
135 | <li><tt>obj</tt> or <tt>o</tt> — Object file, exported bytecode data | ||
136 | (OS- and architecture-specific).</li> | ||
137 | <li><tt>raw</tt> or any other extension — Raw bytecode file (portable). | ||
138 | </ul> | ||
139 | <p> | ||
140 | Notes: | ||
141 | </p> | ||
142 | <ul> | ||
143 | <li>See also <a href="extensions.html#string_dump">string.dump()</a> | ||
144 | for information on bytecode portability and compatibility.</li> | ||
145 | <li>A file in raw bytecode format is auto-detected and can be loaded like | ||
146 | any Lua source file. E.g. directly from the command line or with | ||
147 | <tt>loadfile()</tt>, <tt>dofile()</tt> etc.</li> | ||
148 | <li>To statically embed the bytecode of a module in your application, | ||
149 | generate an object file and just link it with your application.</li> | ||
150 | <li>On most ELF-based systems (e.g. Linux) you need to explicitly export the | ||
151 | global symbols when linking your application, e.g. with: <tt>-Wl,-E</tt></li> | ||
152 | <li><tt>require()</tt> tries to load embedded bytecode data from exported | ||
153 | symbols (in <tt>*.exe</tt> or <tt>lua51.dll</tt> on Windows) and from | ||
154 | shared libraries in <tt>package.cpath</tt>.</li> | ||
155 | </ul> | ||
156 | <p> | ||
125 | Typical usage examples: | 157 | Typical usage examples: |
126 | </p> | 158 | </p> |
127 | <pre class="code"> | 159 | <pre class="code"> |
128 | luajit -b test.lua test.out # Save to test.out | 160 | luajit -b test.lua test.out # Save bytecode to test.out |
129 | luajit -bg test.lua test.out # Keep debug info | 161 | luajit -bg test.lua test.out # Keep debug info |
130 | luajit -be "print('hello world')" test.out # Save cmdline script | 162 | luajit -be "print('hello world')" test.out # Save cmdline script |
131 | 163 | ||
132 | luajit -bl test.lua # List to stdout | 164 | luajit -bl test.lua # List to stdout |
133 | luajit -bl test.lua test.txt # List to test.txt | 165 | luajit -bl test.lua test.txt # List to test.txt |
134 | luajit -ble "print('hello world')" # List cmdline script | 166 | luajit -ble "print('hello world')" # List cmdline script |
167 | |||
168 | luajit -b test.lua test.obj # Generate object file | ||
169 | # Link test.obj with your application and load it with require("test") | ||
135 | </pre> | 170 | </pre> |
136 | <p> | ||
137 | Note: A file in bytecode format is auto-detected and can be loaded like | ||
138 | any Lua source file. E.g. directly from the command line or with | ||
139 | <tt>loadfile()</tt>, <tt>dofile()</tt> etc. See also | ||
140 | <a href="extensions.html#string_dump">string.dump()</a> for information | ||
141 | on bytecode portability and compatibility. | ||
142 | </p> | ||
143 | 171 | ||
144 | <h3 id="opt_j"><tt>-j cmd[=arg[,arg...]]</tt></h3> | 172 | <h3 id="opt_j"><tt>-j cmd[=arg[,arg...]]</tt></h3> |
145 | <p> | 173 | <p> |