├── .gitignore ├── .gitmodules ├── .vscode ├── launch.json └── tasks.json ├── .vscodeignore ├── LICENSE ├── README.md ├── build ├── build.lua └── download.js ├── doc └── en-us │ ├── 51 │ ├── contents.html │ ├── cover.png │ ├── logo.gif │ ├── lua.css │ ├── lua.html │ ├── luac.html │ ├── manual.css │ ├── manual.html │ └── readme.html │ ├── 52 │ ├── contents.html │ ├── logo.gif │ ├── lua.css │ ├── manual.css │ ├── manual.html │ ├── osi-certified-72x60.png │ └── readme.html │ ├── 53 │ ├── contents.html │ ├── index.css │ ├── logo.gif │ ├── lua.css │ ├── manual.css │ ├── manual.html │ ├── osi-certified-72x60.png │ └── readme.html │ └── 54 │ ├── contents.html │ ├── index.css │ ├── logo.gif │ ├── lua.css │ ├── manual.css │ ├── manual.html │ ├── osi-certified-72x60.png │ └── readme.html ├── extension.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | out/ 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "doc/zh-cn/53"] 2 | path = doc/zh-cn/53 3 | url = https://github.com/cloudwu/lua53doc 4 | [submodule "build/54"] 5 | path = build/54 6 | url = https://github.com/lua/lua 7 | [submodule "build/53"] 8 | path = build/53 9 | url = https://github.com/lua/lua 10 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Extension Tests", 6 | "type": "extensionHost", 7 | "request": "launch", 8 | "runtimeExecutable": "${execPath}", 9 | "sourceMaps": false, 10 | "args": [ 11 | "--extensionDevelopmentPath=${workspaceFolder}" 12 | ] 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "inputs": [ 4 | { 5 | "id": "openLuaDoc", 6 | "type": "command", 7 | "command": "test.lua.doc", 8 | "args": "en-us/54/manual.html#lua_rawget" 9 | } 10 | ], 11 | "tasks": [ 12 | { 13 | "label": "OpenLuaDoc", 14 | "type": "shell", 15 | "command": "${input:openLuaDoc}", 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/* 2 | out/* 3 | build/* 4 | .gitignore 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 - present actboy168 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Lua Doc 2 | 3 | This is part of [vscode-lua](https://github.com/LuaLS/vscode-lua). 4 | 5 | ``` js 6 | vscode.commands.executeCommand('test.lua.doc', "en-us/54/manual.html#lua_rawget"); 7 | ``` 8 | -------------------------------------------------------------------------------- /build/build.lua: -------------------------------------------------------------------------------- 1 | local function lua() 2 | local i = 0 3 | while arg[i] ~= nil do 4 | i = i - 1 5 | end 6 | return arg[i + 1] 7 | end 8 | 9 | local function exec(...) 10 | local args = table.pack(...) 11 | table.insert(args, 1, lua()) 12 | os.execute(table.concat(args, " ")) 13 | end 14 | 15 | local function build(ver) 16 | exec("build/"..ver.."/manual/2html", "doc/en-us/"..ver.."/manual.html") 17 | os.remove("out/en-us/"..ver.."/.compiled") 18 | end 19 | 20 | build "54" 21 | build "53" 22 | print "OK!" 23 | -------------------------------------------------------------------------------- /build/download.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | const url = require('url'); 4 | const http = require('http'); 5 | 6 | function download_file(download_url, download_path) { 7 | const options = { 8 | host: url.parse(download_url).host, 9 | port: 80, 10 | path: url.parse(download_url).pathname 11 | }; 12 | var file = fs.createWriteStream(download_path); 13 | http.get(options, function (res) { 14 | res.on('data', function (data) { 15 | file.write(data); 16 | }).on('end', function () { 17 | file.end(); 18 | console.log('OK: ' + download_url); 19 | }); 20 | }); 21 | } 22 | 23 | function download_dir(download_url, download_path) { 24 | fs.mkdirSync(download_path, { recursive: true }); 25 | for (const file of [ 26 | "readme.html", 27 | "contents.html", 28 | "manual.html", 29 | "index.css", 30 | "lua.css", 31 | "manual.css", 32 | "logo.gif", 33 | "osi-certified-72x60.png", 34 | ]) { 35 | download_file(download_url + "/" + file, path.join(download_path, file)); 36 | } 37 | } 38 | 39 | const docPath = path.join(process.cwd(), "doc"); 40 | 41 | for (const config of [ 42 | ["en-us/51", "https://www.lua.org/manual/5.1"], 43 | ["en-us/52", "https://www.lua.org/manual/5.2"], 44 | ["en-us/53", "https://www.lua.org/manual/5.3"], 45 | ["en-us/54", "https://www.lua.org/manual/5.4"], 46 | ]) { 47 | download_dir(config[1], path.join(docPath, config[0])); 48 | } 49 | -------------------------------------------------------------------------------- /doc/en-us/51/contents.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Lua 5.1 Reference Manual - contents 5 | 6 | 7 | 12 | 13 | 14 | 15 | 16 |
17 |

18 | 19 | Lua 5.1 Reference Manual 20 |

21 | 22 |

23 | The reference manual is the official definition of the Lua language. 24 | For a complete introduction to Lua programming, see the book 25 | Programming in Lua. 26 | 27 |

28 | This manual is also available as a book: 29 |

30 | 31 | 32 | 33 | Lua 5.1 Reference Manual 34 |
by R. Ierusalimschy, L. H. de Figueiredo, W. Celes 35 |
Lua.org, August 2006 36 |
ISBN 85-903798-3-3 37 |
38 |
39 | 40 |

41 | Buy a copy 42 | of this book and 43 | help to support 44 | the Lua project. 45 | 46 |

47 | start 48 | · 49 | contents 50 | · 51 | index 52 | · 53 | other versions 54 |


55 | 56 | Copyright © 2006–2012 Lua.org, PUC-Rio. 57 | Freely available under the terms of the 58 | Lua license. 59 | 60 | 61 |

Contents

62 | 151 | 152 |

Index

153 | 154 | 155 | 214 | 318 | 429 | 483 | 484 |
156 |

Lua functions

157 | _G
158 | _VERSION
159 |

160 | 161 | assert
162 | collectgarbage
163 | dofile
164 | error
165 | getfenv
166 | getmetatable
167 | ipairs
168 | load
169 | loadfile
170 | loadstring
171 | module
172 | next
173 | pairs
174 | pcall
175 | print
176 | rawequal
177 | rawget
178 | rawset
179 | require
180 | select
181 | setfenv
182 | setmetatable
183 | tonumber
184 | tostring
185 | type
186 | unpack
187 | xpcall
188 |

189 | 190 | coroutine.create
191 | coroutine.resume
192 | coroutine.running
193 | coroutine.status
194 | coroutine.wrap
195 | coroutine.yield
196 |

197 | 198 | debug.debug
199 | debug.getfenv
200 | debug.gethook
201 | debug.getinfo
202 | debug.getlocal
203 | debug.getmetatable
204 | debug.getregistry
205 | debug.getupvalue
206 | debug.setfenv
207 | debug.sethook
208 | debug.setlocal
209 | debug.setmetatable
210 | debug.setupvalue
211 | debug.traceback
212 | 213 |

215 |

 

216 | file:close
217 | file:flush
218 | file:lines
219 | file:read
220 | file:seek
221 | file:setvbuf
222 | file:write
223 |

224 | 225 | io.close
226 | io.flush
227 | io.input
228 | io.lines
229 | io.open
230 | io.output
231 | io.popen
232 | io.read
233 | io.stderr
234 | io.stdin
235 | io.stdout
236 | io.tmpfile
237 | io.type
238 | io.write
239 |

240 | 241 | math.abs
242 | math.acos
243 | math.asin
244 | math.atan
245 | math.atan2
246 | math.ceil
247 | math.cos
248 | math.cosh
249 | math.deg
250 | math.exp
251 | math.floor
252 | math.fmod
253 | math.frexp
254 | math.huge
255 | math.ldexp
256 | math.log
257 | math.log10
258 | math.max
259 | math.min
260 | math.modf
261 | math.pi
262 | math.pow
263 | math.rad
264 | math.random
265 | math.randomseed
266 | math.sin
267 | math.sinh
268 | math.sqrt
269 | math.tan
270 | math.tanh
271 |

272 | 273 | os.clock
274 | os.date
275 | os.difftime
276 | os.execute
277 | os.exit
278 | os.getenv
279 | os.remove
280 | os.rename
281 | os.setlocale
282 | os.time
283 | os.tmpname
284 |

285 | 286 | package.cpath
287 | package.loaded
288 | package.loaders
289 | package.loadlib
290 | package.path
291 | package.preload
292 | package.seeall
293 |

294 | 295 | string.byte
296 | string.char
297 | string.dump
298 | string.find
299 | string.format
300 | string.gmatch
301 | string.gsub
302 | string.len
303 | string.lower
304 | string.match
305 | string.rep
306 | string.reverse
307 | string.sub
308 | string.upper
309 |

310 | 311 | table.concat
312 | table.insert
313 | table.maxn
314 | table.remove
315 | table.sort
316 | 317 |

319 |

C API

320 | lua_Alloc
321 | lua_CFunction
322 | lua_Debug
323 | lua_Hook
324 | lua_Integer
325 | lua_Number
326 | lua_Reader
327 | lua_State
328 | lua_Writer
329 |

330 | 331 | lua_atpanic
332 | lua_call
333 | lua_checkstack
334 | lua_close
335 | lua_concat
336 | lua_cpcall
337 | lua_createtable
338 | lua_dump
339 | lua_equal
340 | lua_error
341 | lua_gc
342 | lua_getallocf
343 | lua_getfenv
344 | lua_getfield
345 | lua_getglobal
346 | lua_gethook
347 | lua_gethookcount
348 | lua_gethookmask
349 | lua_getinfo
350 | lua_getlocal
351 | lua_getmetatable
352 | lua_getstack
353 | lua_gettable
354 | lua_gettop
355 | lua_getupvalue
356 | lua_insert
357 | lua_isboolean
358 | lua_iscfunction
359 | lua_isfunction
360 | lua_islightuserdata
361 | lua_isnil
362 | lua_isnone
363 | lua_isnoneornil
364 | lua_isnumber
365 | lua_isstring
366 | lua_istable
367 | lua_isthread
368 | lua_isuserdata
369 | lua_lessthan
370 | lua_load
371 | lua_newstate
372 | lua_newtable
373 | lua_newthread
374 | lua_newuserdata
375 | lua_next
376 | lua_objlen
377 | lua_pcall
378 | lua_pop
379 | lua_pushboolean
380 | lua_pushcclosure
381 | lua_pushcfunction
382 | lua_pushfstring
383 | lua_pushinteger
384 | lua_pushlightuserdata
385 | lua_pushliteral
386 | lua_pushlstring
387 | lua_pushnil
388 | lua_pushnumber
389 | lua_pushstring
390 | lua_pushthread
391 | lua_pushvalue
392 | lua_pushvfstring
393 | lua_rawequal
394 | lua_rawget
395 | lua_rawgeti
396 | lua_rawset
397 | lua_rawseti
398 | lua_register
399 | lua_remove
400 | lua_replace
401 | lua_resume
402 | lua_setallocf
403 | lua_setfenv
404 | lua_setfield
405 | lua_setglobal
406 | lua_sethook
407 | lua_setlocal
408 | lua_setmetatable
409 | lua_settable
410 | lua_settop
411 | lua_setupvalue
412 | lua_status
413 | lua_toboolean
414 | lua_tocfunction
415 | lua_tointeger
416 | lua_tolstring
417 | lua_tonumber
418 | lua_topointer
419 | lua_tostring
420 | lua_tothread
421 | lua_touserdata
422 | lua_type
423 | lua_typename
424 | lua_upvalueindex
425 | lua_xmove
426 | lua_yield
427 | 428 |

430 |

auxiliary library

431 | luaL_Buffer
432 | luaL_Reg
433 |

434 | 435 | luaL_addchar
436 | luaL_addlstring
437 | luaL_addsize
438 | luaL_addstring
439 | luaL_addvalue
440 | luaL_argcheck
441 | luaL_argerror
442 | luaL_buffinit
443 | luaL_callmeta
444 | luaL_checkany
445 | luaL_checkint
446 | luaL_checkinteger
447 | luaL_checklong
448 | luaL_checklstring
449 | luaL_checknumber
450 | luaL_checkoption
451 | luaL_checkstack
452 | luaL_checkstring
453 | luaL_checktype
454 | luaL_checkudata
455 | luaL_dofile
456 | luaL_dostring
457 | luaL_error
458 | luaL_getmetafield
459 | luaL_getmetatable
460 | luaL_gsub
461 | luaL_loadbuffer
462 | luaL_loadfile
463 | luaL_loadstring
464 | luaL_newmetatable
465 | luaL_newstate
466 | luaL_openlibs
467 | luaL_optint
468 | luaL_optinteger
469 | luaL_optlong
470 | luaL_optlstring
471 | luaL_optnumber
472 | luaL_optstring
473 | luaL_prepbuffer
474 | luaL_pushresult
475 | luaL_ref
476 | luaL_register
477 | luaL_typename
478 | luaL_typerror
479 | luaL_unref
480 | luaL_where
481 | 482 |

485 |

486 | 487 |


488 | 489 | Last update: 490 | Mon Feb 13 18:53:32 BRST 2012 491 | 492 | 495 | 496 | 497 | 498 | -------------------------------------------------------------------------------- /doc/en-us/51/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LuaLS/vscode-lua-doc/fd6c8cd04787764938368baeb3e34d06d203313d/doc/en-us/51/cover.png -------------------------------------------------------------------------------- /doc/en-us/51/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LuaLS/vscode-lua-doc/fd6c8cd04787764938368baeb3e34d06d203313d/doc/en-us/51/logo.gif -------------------------------------------------------------------------------- /doc/en-us/51/lua.css: -------------------------------------------------------------------------------- 1 | body { 2 | color: #000000 ; 3 | background-color: #FFFFFF ; 4 | font-family: Helvetica, Arial, sans-serif ; 5 | text-align: justify ; 6 | margin-right: 30px ; 7 | margin-left: 30px ; 8 | } 9 | 10 | h1, h2, h3, h4 { 11 | font-family: Verdana, Geneva, sans-serif ; 12 | font-weight: normal ; 13 | font-style: italic ; 14 | } 15 | 16 | h2 { 17 | padding-top: 0.4em ; 18 | padding-bottom: 0.4em ; 19 | padding-left: 30px ; 20 | padding-right: 30px ; 21 | margin-left: -30px ; 22 | background-color: #E0E0FF ; 23 | } 24 | 25 | h3 { 26 | padding-left: 0.5em ; 27 | border-left: solid #E0E0FF 1em ; 28 | } 29 | 30 | table h3 { 31 | padding-left: 0px ; 32 | border-left: none ; 33 | } 34 | 35 | a:link { 36 | color: #000080 ; 37 | background-color: inherit ; 38 | text-decoration: none ; 39 | } 40 | 41 | a:visited { 42 | background-color: inherit ; 43 | text-decoration: none ; 44 | } 45 | 46 | a:link:hover, a:visited:hover { 47 | color: #000080 ; 48 | background-color: #E0E0FF ; 49 | } 50 | 51 | a:link:active, a:visited:active { 52 | color: #FF0000 ; 53 | } 54 | 55 | hr { 56 | border: 0 ; 57 | height: 1px ; 58 | color: #a0a0a0 ; 59 | background-color: #a0a0a0 ; 60 | } 61 | 62 | :target { 63 | background-color: #F8F8F8 ; 64 | padding: 8px ; 65 | border: solid #a0a0a0 2px ; 66 | } 67 | 68 | .footer { 69 | color: gray ; 70 | font-size: small ; 71 | } 72 | 73 | input[type=text] { 74 | border: solid #a0a0a0 2px ; 75 | border-radius: 2em ; 76 | -moz-border-radius: 2em ; 77 | background-image: url('images/search.png') ; 78 | background-repeat: no-repeat; 79 | background-position: 4px center ; 80 | padding-left: 20px ; 81 | height: 2em ; 82 | } 83 | 84 | -------------------------------------------------------------------------------- /doc/en-us/51/lua.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LUA man page 5 | 6 | 7 | 8 | 9 | 10 |

NAME

11 | lua - Lua interpreter 12 |

SYNOPSIS

13 | lua 14 | [ 15 | options 16 | ] 17 | [ 18 | script 19 | [ 20 | args 21 | ] 22 | ] 23 |

DESCRIPTION

24 | lua 25 | is the stand-alone Lua interpreter. 26 | It loads and executes Lua programs, 27 | either in textual source form or 28 | in precompiled binary form. 29 | (Precompiled binaries are output by 30 | luac, 31 | the Lua compiler.) 32 | lua 33 | can be used as a batch interpreter and also interactively. 34 |

35 | The given 36 | options 37 | (see below) 38 | are executed and then 39 | the Lua program in file 40 | script 41 | is loaded and executed. 42 | The given 43 | args 44 | are available to 45 | script 46 | as strings in a global table named 47 | arg. 48 | If these arguments contain spaces or other characters special to the shell, 49 | then they should be quoted 50 | (but note that the quotes will be removed by the shell). 51 | The arguments in 52 | arg 53 | start at 0, 54 | which contains the string 55 | 'script'. 56 | The index of the last argument is stored in 57 | arg.n. 58 | The arguments given in the command line before 59 | script, 60 | including the name of the interpreter, 61 | are available in negative indices in 62 | arg. 63 |

64 | At the very start, 65 | before even handling the command line, 66 | lua 67 | executes the contents of the environment variable 68 | LUA_INIT, 69 | if it is defined. 70 | If the value of 71 | LUA_INIT 72 | is of the form 73 | '@filename', 74 | then 75 | filename 76 | is executed. 77 | Otherwise, the string is assumed to be a Lua statement and is executed. 78 |

79 | Options start with 80 | '-' 81 | and are described below. 82 | You can use 83 | '--' 84 | to signal the end of options. 85 |

86 | If no arguments are given, 87 | then 88 | "-v -i" 89 | is assumed when the standard input is a terminal; 90 | otherwise, 91 | "-" 92 | is assumed. 93 |

94 | In interactive mode, 95 | lua 96 | prompts the user, 97 | reads lines from the standard input, 98 | and executes them as they are read. 99 | If a line does not contain a complete statement, 100 | then a secondary prompt is displayed and 101 | lines are read until a complete statement is formed or 102 | a syntax error is found. 103 | So, one way to interrupt the reading of an incomplete statement is 104 | to force a syntax error: 105 | adding a 106 | ';' 107 | in the middle of a statement is a sure way of forcing a syntax error 108 | (except inside multiline strings and comments; these must be closed explicitly). 109 | If a line starts with 110 | '=', 111 | then 112 | lua 113 | displays the values of all the expressions in the remainder of the 114 | line. The expressions must be separated by commas. 115 | The primary prompt is the value of the global variable 116 | _PROMPT, 117 | if this value is a string; 118 | otherwise, the default prompt is used. 119 | Similarly, the secondary prompt is the value of the global variable 120 | _PROMPT2. 121 | So, 122 | to change the prompts, 123 | set the corresponding variable to a string of your choice. 124 | You can do that after calling the interpreter 125 | or on the command line 126 | (but in this case you have to be careful with quotes 127 | if the prompt string contains a space; otherwise you may confuse the shell.) 128 | The default prompts are "> " and ">> ". 129 |

OPTIONS

130 |

131 | - 132 | load and execute the standard input as a file, 133 | that is, 134 | not interactively, 135 | even when the standard input is a terminal. 136 |

137 | -e stat 138 | execute statement 139 | stat. 140 | You need to quote 141 | stat 142 | if it contains spaces, quotes, 143 | or other characters special to the shell. 144 |

145 | -i 146 | enter interactive mode after 147 | script 148 | is executed. 149 |

150 | -l name 151 | call 152 | require('name') 153 | before executing 154 | script. 155 | Typically used to load libraries. 156 |

157 | -v 158 | show version information. 159 |

SEE ALSO

160 | luac(1) 161 |
162 | http://www.lua.org/ 163 |

DIAGNOSTICS

164 | Error messages should be self explanatory. 165 |

AUTHORS

166 | R. Ierusalimschy, 167 | L. H. de Figueiredo, 168 | and 169 | W. Celes 170 | 171 | 172 | 173 | -------------------------------------------------------------------------------- /doc/en-us/51/luac.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LUAC man page 5 | 6 | 7 | 8 | 9 | 10 |

NAME

11 | luac - Lua compiler 12 |

SYNOPSIS

13 | luac 14 | [ 15 | options 16 | ] [ 17 | filenames 18 | ] 19 |

DESCRIPTION

20 | luac 21 | is the Lua compiler. 22 | It translates programs written in the Lua programming language 23 | into binary files that can be later loaded and executed. 24 |

25 | The main advantages of precompiling chunks are: 26 | faster loading, 27 | protecting source code from accidental user changes, 28 | and 29 | off-line syntax checking. 30 |

31 | Precompiling does not imply faster execution 32 | because in Lua chunks are always compiled into bytecodes before being executed. 33 | luac 34 | simply allows those bytecodes to be saved in a file for later execution. 35 |

36 | Precompiled chunks are not necessarily smaller than the corresponding source. 37 | The main goal in precompiling is faster loading. 38 |

39 | The binary files created by 40 | luac 41 | are portable only among architectures with the same word size and byte order. 42 |

43 | luac 44 | produces a single output file containing the bytecodes 45 | for all source files given. 46 | By default, 47 | the output file is named 48 | luac.out, 49 | but you can change this with the 50 | -o 51 | option. 52 |

53 | In the command line, 54 | you can mix 55 | text files containing Lua source and 56 | binary files containing precompiled chunks. 57 | This is useful because several precompiled chunks, 58 | even from different (but compatible) platforms, 59 | can be combined into a single precompiled chunk. 60 |

61 | You can use 62 | '-' 63 | to indicate the standard input as a source file 64 | and 65 | '--' 66 | to signal the end of options 67 | (that is, 68 | all remaining arguments will be treated as files even if they start with 69 | '-'). 70 |

71 | The internal format of the binary files produced by 72 | luac 73 | is likely to change when a new version of Lua is released. 74 | So, 75 | save the source files of all Lua programs that you precompile. 76 |

77 |

OPTIONS

78 | Options must be separate. 79 |

80 | -l 81 | produce a listing of the compiled bytecode for Lua's virtual machine. 82 | Listing bytecodes is useful to learn about Lua's virtual machine. 83 | If no files are given, then 84 | luac 85 | loads 86 | luac.out 87 | and lists its contents. 88 |

89 | -o file 90 | output to 91 | file, 92 | instead of the default 93 | luac.out. 94 | (You can use 95 | '-' 96 | for standard output, 97 | but not on platforms that open standard output in text mode.) 98 | The output file may be a source file because 99 | all files are loaded before the output file is written. 100 | Be careful not to overwrite precious files. 101 |

102 | -p 103 | load files but do not generate any output file. 104 | Used mainly for syntax checking and for testing precompiled chunks: 105 | corrupted files will probably generate errors when loaded. 106 | Lua always performs a thorough integrity test on precompiled chunks. 107 | Bytecode that passes this test is completely safe, 108 | in the sense that it will not break the interpreter. 109 | However, 110 | there is no guarantee that such code does anything sensible. 111 | (None can be given, because the halting problem is unsolvable.) 112 | If no files are given, then 113 | luac 114 | loads 115 | luac.out 116 | and tests its contents. 117 | No messages are displayed if the file passes the integrity test. 118 |

119 | -s 120 | strip debug information before writing the output file. 121 | This saves some space in very large chunks, 122 | but if errors occur when running a stripped chunk, 123 | then the error messages may not contain the full information they usually do. 124 | For instance, 125 | line numbers and names of local variables are lost. 126 |

127 | -v 128 | show version information. 129 |

FILES

130 |

131 | luac.out 132 | default output file 133 |

SEE ALSO

134 | lua(1) 135 |
136 | http://www.lua.org/ 137 |

DIAGNOSTICS

138 | Error messages should be self explanatory. 139 |

AUTHORS

140 | L. H. de Figueiredo, 141 | R. Ierusalimschy and 142 | W. Celes 143 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /doc/en-us/51/manual.css: -------------------------------------------------------------------------------- 1 | h3 code { 2 | font-family: inherit ; 3 | font-size: inherit ; 4 | } 5 | 6 | pre, code { 7 | font-size: 12pt ; 8 | } 9 | 10 | span.apii { 11 | float: right ; 12 | font-family: inherit ; 13 | font-style: normal ; 14 | font-size: small ; 15 | color: gray ; 16 | } 17 | 18 | p+h1, ul+h1 { 19 | padding-top: 0.4em ; 20 | padding-bottom: 0.4em ; 21 | padding-left: 30px ; 22 | margin-left: -30px ; 23 | background-color: #E0E0FF ; 24 | } 25 | -------------------------------------------------------------------------------- /doc/en-us/51/readme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Lua documentation 4 | 5 | 6 | 7 | 8 | 9 |
10 |

11 | Lua 12 | Documentation 13 |

14 | 15 | This is the documentation included in the source distribution of Lua 5.1.5. 16 | 17 | 25 | 26 | Lua's 27 | official web site 28 | contains updated documentation, 29 | especially the 30 | reference manual. 31 |

32 | 33 |


34 | 35 | Last update: 36 | Fri Feb 3 09:44:42 BRST 2012 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /doc/en-us/52/contents.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Lua 5.2 Reference Manual - contents 5 | 6 | 7 | 12 | 13 | 14 | 15 | 16 |
17 |

18 | 19 | Lua 5.2 Reference Manual 20 |

21 | 22 |

23 | The reference manual is the official definition of the Lua language. 24 | For a complete introduction to Lua programming, see the book 25 | Programming in Lua. 26 | 27 |

28 | start 29 | · 30 | contents 31 | · 32 | index 33 |


34 | 35 | Copyright © 2011–2015 Lua.org, PUC-Rio. 36 | Freely available under the terms of the 37 | Lua license. 38 | 39 | 40 |

Contents

41 | 134 | 135 |

Index

136 | 137 | 138 | 237 | 331 | 461 | 595 | 596 |
139 |

Lua functions

140 |

141 | basic
142 | _G
143 | _VERSION
144 | 145 | assert
146 | collectgarbage
147 | dofile
148 | error
149 | getmetatable
150 | ipairs
151 | load
152 | loadfile
153 | next
154 | pairs
155 | pcall
156 | print
157 | rawequal
158 | rawget
159 | rawlen
160 | rawset
161 | require
162 | select
163 | setmetatable
164 | tonumber
165 | tostring
166 | type
167 | xpcall
168 | 169 |

170 | bit32
171 | bit32.arshift
172 | bit32.band
173 | bit32.bnot
174 | bit32.bor
175 | bit32.btest
176 | bit32.bxor
177 | bit32.extract
178 | bit32.lrotate
179 | bit32.lshift
180 | bit32.replace
181 | bit32.rrotate
182 | bit32.rshift
183 | 184 |

185 | coroutine
186 | coroutine.create
187 | coroutine.resume
188 | coroutine.running
189 | coroutine.status
190 | coroutine.wrap
191 | coroutine.yield
192 | 193 |

194 | debug
195 | debug.debug
196 | debug.getuservalue
197 | debug.gethook
198 | debug.getinfo
199 | debug.getlocal
200 | debug.getmetatable
201 | debug.getregistry
202 | debug.getupvalue
203 | debug.setuservalue
204 | debug.sethook
205 | debug.setlocal
206 | debug.setmetatable
207 | debug.setupvalue
208 | debug.traceback
209 | debug.upvalueid
210 | debug.upvaluejoin
211 | 212 |

213 | io
214 | io.close
215 | io.flush
216 | io.input
217 | io.lines
218 | io.open
219 | io.output
220 | io.popen
221 | io.read
222 | io.stderr
223 | io.stdin
224 | io.stdout
225 | io.tmpfile
226 | io.type
227 | io.write
228 | file:close
229 | file:flush
230 | file:lines
231 | file:read
232 | file:seek
233 | file:setvbuf
234 | file:write
235 | 236 |

238 |

 

239 |

240 | math
241 | math.abs
242 | math.acos
243 | math.asin
244 | math.atan
245 | math.atan2
246 | math.ceil
247 | math.cos
248 | math.cosh
249 | math.deg
250 | math.exp
251 | math.floor
252 | math.fmod
253 | math.frexp
254 | math.huge
255 | math.ldexp
256 | math.log
257 | math.max
258 | math.min
259 | math.modf
260 | math.pi
261 | math.pow
262 | math.rad
263 | math.random
264 | math.randomseed
265 | math.sin
266 | math.sinh
267 | math.sqrt
268 | math.tan
269 | math.tanh
270 | 271 |

272 | os
273 | os.clock
274 | os.date
275 | os.difftime
276 | os.execute
277 | os.exit
278 | os.getenv
279 | os.remove
280 | os.rename
281 | os.setlocale
282 | os.time
283 | os.tmpname
284 | 285 |

286 | package
287 | package.config
288 | package.cpath
289 | package.loaded
290 | package.loadlib
291 | package.path
292 | package.preload
293 | package.searchers
294 | package.searchpath
295 | 296 |

297 | string
298 | string.byte
299 | string.char
300 | string.dump
301 | string.find
302 | string.format
303 | string.gmatch
304 | string.gsub
305 | string.len
306 | string.lower
307 | string.match
308 | string.rep
309 | string.reverse
310 | string.sub
311 | string.upper
312 | 313 |

314 | table
315 | table.concat
316 | table.insert
317 | table.pack
318 | table.remove
319 | table.sort
320 | table.unpack
321 | 322 |

environment
variables

323 | LUA_CPATH
324 | LUA_CPATH_5_2
325 | LUA_INIT
326 | LUA_INIT_5_2
327 | LUA_PATH
328 | LUA_PATH_5_2
329 | 330 |
332 |

C API

333 |

334 | lua_Alloc
335 | lua_CFunction
336 | lua_Debug
337 | lua_Hook
338 | lua_Integer
339 | lua_Number
340 | lua_Reader
341 | lua_State
342 | lua_Unsigned
343 | lua_Writer
344 | 345 |

346 | lua_absindex
347 | lua_arith
348 | lua_atpanic
349 | lua_call
350 | lua_callk
351 | lua_checkstack
352 | lua_close
353 | lua_compare
354 | lua_concat
355 | lua_copy
356 | lua_createtable
357 | lua_dump
358 | lua_error
359 | lua_gc
360 | lua_getallocf
361 | lua_getctx
362 | lua_getfield
363 | lua_getglobal
364 | lua_gethook
365 | lua_gethookcount
366 | lua_gethookmask
367 | lua_getinfo
368 | lua_getlocal
369 | lua_getmetatable
370 | lua_getstack
371 | lua_gettable
372 | lua_gettop
373 | lua_getupvalue
374 | lua_getuservalue
375 | lua_insert
376 | lua_isboolean
377 | lua_iscfunction
378 | lua_isfunction
379 | lua_islightuserdata
380 | lua_isnil
381 | lua_isnone
382 | lua_isnoneornil
383 | lua_isnumber
384 | lua_isstring
385 | lua_istable
386 | lua_isthread
387 | lua_isuserdata
388 | lua_len
389 | lua_load
390 | lua_newstate
391 | lua_newtable
392 | lua_newthread
393 | lua_newuserdata
394 | lua_next
395 | lua_pcall
396 | lua_pcallk
397 | lua_pop
398 | lua_pushboolean
399 | lua_pushcclosure
400 | lua_pushcfunction
401 | lua_pushfstring
402 | lua_pushglobaltable
403 | lua_pushinteger
404 | lua_pushlightuserdata
405 | lua_pushliteral
406 | lua_pushlstring
407 | lua_pushnil
408 | lua_pushnumber
409 | lua_pushstring
410 | lua_pushthread
411 | lua_pushunsigned
412 | lua_pushvalue
413 | lua_pushvfstring
414 | lua_rawequal
415 | lua_rawget
416 | lua_rawgeti
417 | lua_rawgetp
418 | lua_rawlen
419 | lua_rawset
420 | lua_rawseti
421 | lua_rawsetp
422 | lua_register
423 | lua_remove
424 | lua_replace
425 | lua_resume
426 | lua_setallocf
427 | lua_setfield
428 | lua_setglobal
429 | lua_sethook
430 | lua_setlocal
431 | lua_setmetatable
432 | lua_settable
433 | lua_settop
434 | lua_setupvalue
435 | lua_setuservalue
436 | lua_status
437 | lua_toboolean
438 | lua_tocfunction
439 | lua_tointeger
440 | lua_tointegerx
441 | lua_tolstring
442 | lua_tonumber
443 | lua_tonumberx
444 | lua_topointer
445 | lua_tostring
446 | lua_tothread
447 | lua_tounsigned
448 | lua_tounsignedx
449 | lua_touserdata
450 | lua_type
451 | lua_typename
452 | lua_upvalueid
453 | lua_upvalueindex
454 | lua_upvaluejoin
455 | lua_version
456 | lua_xmove
457 | lua_yield
458 | lua_yieldk
459 | 460 |

462 |

auxiliary library

463 |

464 | luaL_Buffer
465 | luaL_Reg
466 | 467 |

468 | luaL_addchar
469 | luaL_addlstring
470 | luaL_addsize
471 | luaL_addstring
472 | luaL_addvalue
473 | luaL_argcheck
474 | luaL_argerror
475 | luaL_buffinit
476 | luaL_buffinitsize
477 | luaL_callmeta
478 | luaL_checkany
479 | luaL_checkint
480 | luaL_checkinteger
481 | luaL_checklong
482 | luaL_checklstring
483 | luaL_checknumber
484 | luaL_checkoption
485 | luaL_checkstack
486 | luaL_checkstring
487 | luaL_checktype
488 | luaL_checkudata
489 | luaL_checkunsigned
490 | luaL_checkversion
491 | luaL_dofile
492 | luaL_dostring
493 | luaL_error
494 | luaL_execresult
495 | luaL_fileresult
496 | luaL_getmetafield
497 | luaL_getmetatable
498 | luaL_getsubtable
499 | luaL_gsub
500 | luaL_len
501 | luaL_loadbuffer
502 | luaL_loadbufferx
503 | luaL_loadfile
504 | luaL_loadfilex
505 | luaL_loadstring
506 | luaL_newlib
507 | luaL_newlibtable
508 | luaL_newmetatable
509 | luaL_newstate
510 | luaL_openlibs
511 | luaL_optint
512 | luaL_optinteger
513 | luaL_optlong
514 | luaL_optlstring
515 | luaL_optnumber
516 | luaL_optstring
517 | luaL_optunsigned
518 | luaL_prepbuffer
519 | luaL_prepbuffsize
520 | luaL_pushresult
521 | luaL_pushresultsize
522 | luaL_ref
523 | luaL_requiref
524 | luaL_setfuncs
525 | luaL_setmetatable
526 | luaL_testudata
527 | luaL_tolstring
528 | luaL_traceback
529 | luaL_typename
530 | luaL_unref
531 | luaL_where
532 | 533 |

standard library

534 |

535 | luaopen_base
536 | luaopen_bit32
537 | luaopen_coroutine
538 | luaopen_debug
539 | luaopen_io
540 | luaopen_math
541 | luaopen_os
542 | luaopen_package
543 | luaopen_string
544 | luaopen_table
545 | 546 |

constants

547 | LUA_ERRERR
548 | LUA_ERRFILE
549 | LUA_ERRGCMM
550 | LUA_ERRMEM
551 | LUA_ERRRUN
552 | LUA_ERRSYNTAX
553 | LUA_HOOKCALL
554 | LUA_HOOKCOUNT
555 | LUA_HOOKLINE
556 | LUA_HOOKRET
557 | LUA_HOOKTAILCALL
558 | LUA_MASKCALL
559 | LUA_MASKCOUNT
560 | LUA_MASKLINE
561 | LUA_MASKRET
562 | LUA_MINSTACK
563 | LUA_MULTRET
564 | LUA_NOREF
565 | LUA_OK
566 | LUA_OPADD
567 | LUA_OPDIV
568 | LUA_OPEQ
569 | LUA_OPLE
570 | LUA_OPLT
571 | LUA_OPMOD
572 | LUA_OPMUL
573 | LUA_OPPOW
574 | LUA_OPSUB
575 | LUA_OPUNM
576 | LUA_REFNIL
577 | LUA_REGISTRYINDEX
578 | LUA_RIDX_GLOBALS
579 | LUA_RIDX_MAINTHREAD
580 | LUA_TBOOLEAN
581 | LUA_TFUNCTION
582 | LUA_TLIGHTUSERDATA
583 | LUA_TNIL
584 | LUA_TNONE
585 | LUA_TNUMBER
586 | LUA_TSTRING
587 | LUA_TTABLE
588 | LUA_TTHREAD
589 | LUA_TUSERDATA
590 | LUA_USE_APICHECK
591 | LUA_YIELD
592 | LUAL_BUFFERSIZE
593 | 594 |
597 | 598 |
599 | 600 | Last update: 601 | Mon Feb 23 22:24:36 BRT 2015 602 | 603 | 606 | 607 | 608 | 609 | -------------------------------------------------------------------------------- /doc/en-us/52/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LuaLS/vscode-lua-doc/fd6c8cd04787764938368baeb3e34d06d203313d/doc/en-us/52/logo.gif -------------------------------------------------------------------------------- /doc/en-us/52/lua.css: -------------------------------------------------------------------------------- 1 | html { 2 | background-color: #F8F8F8 ; 3 | } 4 | 5 | body { 6 | border: solid #a0a0a0 1px ; 7 | border-radius: 20px ; 8 | padding: 26px ; 9 | margin: 16px ; 10 | color: #000000 ; 11 | background-color: #FFFFFF ; 12 | font-family: Helvetica, Arial, sans-serif ; 13 | text-align: justify ; 14 | line-height: 1.25 ; 15 | } 16 | 17 | h1, h2, h3, h4 { 18 | font-family: Verdana, Geneva, sans-serif ; 19 | font-weight: normal ; 20 | font-style: normal ; 21 | } 22 | 23 | h2 { 24 | padding-top: 0.4em ; 25 | padding-bottom: 0.4em ; 26 | padding-left: 0.8em ; 27 | padding-right: 0.8em ; 28 | background-color: #D0D0FF ; 29 | border-radius: 8px ; 30 | border: solid #a0a0a0 1px ; 31 | } 32 | 33 | h3 { 34 | padding-left: 0.5em ; 35 | border-left: solid #D0D0FF 1em ; 36 | } 37 | 38 | table h3 { 39 | padding-left: 0px ; 40 | border-left: none ; 41 | } 42 | 43 | a:link { 44 | color: #000080 ; 45 | background-color: inherit ; 46 | text-decoration: none ; 47 | } 48 | 49 | a:visited { 50 | background-color: inherit ; 51 | text-decoration: none ; 52 | } 53 | 54 | a:link:hover, a:visited:hover { 55 | color: #000080 ; 56 | background-color: #D0D0FF ; 57 | border-radius: 4px ; 58 | } 59 | 60 | a:link:active, a:visited:active { 61 | color: #FF0000 ; 62 | } 63 | 64 | h1 a img { 65 | vertical-align: text-bottom ; 66 | } 67 | 68 | hr { 69 | border: 0 ; 70 | height: 1px ; 71 | color: #a0a0a0 ; 72 | background-color: #a0a0a0 ; 73 | display: none ; 74 | } 75 | 76 | table hr { 77 | display: block ; 78 | } 79 | 80 | :target { 81 | background-color: #F8F8F8 ; 82 | padding: 8px ; 83 | border: solid #a0a0a0 2px ; 84 | border-radius: 8px ; 85 | } 86 | 87 | .footer { 88 | color: gray ; 89 | font-size: x-small ; 90 | } 91 | 92 | input[type=text] { 93 | border: solid #a0a0a0 2px ; 94 | border-radius: 2em ; 95 | background-image: url('images/search.png') ; 96 | background-repeat: no-repeat ; 97 | background-position: 4px center ; 98 | padding-left: 20px ; 99 | height: 2em ; 100 | } 101 | 102 | pre.session { 103 | background-color: #F8F8F8 ; 104 | padding: 1em ; 105 | border-radius: 8px ; 106 | } 107 | -------------------------------------------------------------------------------- /doc/en-us/52/manual.css: -------------------------------------------------------------------------------- 1 | h3 code { 2 | font-family: inherit ; 3 | font-size: inherit ; 4 | } 5 | 6 | pre, code { 7 | font-size: 12pt ; 8 | } 9 | 10 | span.apii { 11 | float: right ; 12 | font-family: inherit ; 13 | font-style: normal ; 14 | font-size: small ; 15 | color: gray ; 16 | } 17 | 18 | p+h1, ul+h1 { 19 | font-style: normal ; 20 | padding-top: 0.4em ; 21 | padding-bottom: 0.4em ; 22 | padding-left: 16px ; 23 | margin-left: -16px ; 24 | background-color: #D0D0FF ; 25 | border-radius: 8px ; 26 | border: solid #000080 1px ; 27 | } 28 | -------------------------------------------------------------------------------- /doc/en-us/52/osi-certified-72x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LuaLS/vscode-lua-doc/fd6c8cd04787764938368baeb3e34d06d203313d/doc/en-us/52/osi-certified-72x60.png -------------------------------------------------------------------------------- /doc/en-us/52/readme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Lua 5.2 readme 5 | 6 | 7 | 27 | 28 | 29 | 30 | 31 |
32 |

33 | Lua 34 | Welcome to Lua 5.2 35 |

36 | 37 |

38 | about 39 | · 40 | installation 41 | · 42 | changes 43 | · 44 | license 45 | · 46 | reference manual 47 | 48 |

About Lua

49 | 50 |

51 | Lua is a powerful, fast, lightweight, embeddable scripting language 52 | developed by a 53 | team 54 | at 55 | PUC-Rio, 56 | the Pontifical Catholic University of Rio de Janeiro in Brazil. 57 | Lua is 58 | free software 59 | used in many products and projects around the world. 60 | 61 |

62 | Lua's 63 | official web site 64 | provides complete information 65 | about Lua, 66 | including 67 | an 68 | executive summary 69 | and 70 | updated 71 | documentation, 72 | especially the 73 | reference manual, 74 | which may differ slightly from the 75 | local copy 76 | distributed in this package. 77 | 78 |

Installing Lua

79 | 80 |

81 | Lua is distributed in 82 | source 83 | form. 84 | You need to build it before using it. 85 | Building Lua should be straightforward 86 | because 87 | Lua is implemented in pure ANSI C and compiles unmodified in all known 88 | platforms that have an ANSI C compiler. 89 | Lua also compiles unmodified as C++. 90 | The instructions given below for building Lua are for Unix-like platforms. 91 | See also 92 | instructions for other systems 93 | and 94 | customization options. 95 | 96 |

97 | If you don't have the time or the inclination to compile Lua yourself, 98 | get a binary from 99 | LuaBinaries. 100 | Try also 101 | LuaDist, 102 | a multi-platform distribution of Lua that includes batteries. 103 | 104 |

Building Lua

105 | 106 |

107 | In most Unix-like platforms, simply do "make" with a suitable target. 108 | Here are the details. 109 | 110 |

    111 |
  1. 112 | Open a terminal window and move to 113 | the top-level directory, which is named lua-5.2.x. 114 | The Makefile there controls both the build process and the installation process. 115 |

    116 |

  2. 117 | Do "make" and see if your platform is listed. 118 | The platforms currently supported are: 119 |

    120 |

    121 | aix ansi bsd freebsd generic linux macosx mingw posix solaris 122 |

    123 |

    124 | If your platform is listed, just do "make xxx", where xxx 125 | is your platform name. 126 |

    127 | If your platform is not listed, try the closest one or posix, generic, 128 | ansi, in this order. 129 |

    130 |

  3. 131 | The compilation takes only a few moments 132 | and produces three files in the src directory: 133 | lua (the interpreter), 134 | luac (the compiler), 135 | and liblua.a (the library). 136 |

    137 |

  4. 138 | To check that Lua has been built correctly, do "make test" 139 | after building Lua. This will run the interpreter and print its version. 140 |
141 |

142 | If you're running Linux and get compilation errors, 143 | make sure you have installed the readline development package 144 | (which is probably named libreadline-dev or readline-devel). 145 | If you get link errors after that, 146 | then try "make linux MYLIBS=-ltermcap". 147 | 148 |

Installing Lua

149 |

150 | Once you have built Lua, you may want to install it in an official 151 | place in your system. In this case, do "make install". The official 152 | place and the way to install files are defined in the Makefile. You'll 153 | probably need the right permissions to install files. 154 | 155 |

156 | To build and install Lua in one step, do "make xxx install", 157 | where xxx is your platform name. 158 | 159 |

160 | To install Lua locally, do "make local". 161 | This will create a directory install with subdirectories 162 | bin, include, lib, man, share, 163 | and install Lua as listed below. 164 | 165 | To install Lua locally, but in some other directory, do 166 | "make install INSTALL_TOP=xxx", where xxx is your chosen directory. 167 | The installation starts in the src and doc directories, 168 | so take care if INSTALL_TOP is not an absolute path. 169 | 170 |

171 |
172 | bin: 173 |
174 | lua luac 175 |
176 | include: 177 |
178 | lua.h luaconf.h lualib.h lauxlib.h lua.hpp 179 |
180 | lib: 181 |
182 | liblua.a 183 |
184 | man/man1: 185 |
186 | lua.1 luac.1 187 |
188 | 189 |

190 | These are the only directories you need for development. 191 | If you only want to run Lua programs, 192 | you only need the files in bin and man. 193 | The files in include and lib are needed for 194 | embedding Lua in C or C++ programs. 195 | 196 |

Customization

197 |

198 | Three kinds of things can be customized by editing a file: 199 |

204 | 205 |

206 | You don't actually need to edit the Makefiles because you may set the 207 | relevant variables in the command line when invoking make. 208 | Nevertheless, it's probably best to edit and save the Makefiles to 209 | record the changes you've made. 210 | 211 |

212 | On the other hand, if you need to customize some Lua features, you'll need 213 | to edit src/luaconf.h before building and installing Lua. 214 | The edited file will be the one installed, and 215 | it will be used by any Lua clients that you build, to ensure consistency. 216 | Further customization is available to experts by editing the Lua sources. 217 | 218 |

219 | We strongly recommend that you enable dynamic loading in src/luaconf.h. 220 | This is done automatically for all platforms listed above that have 221 | this feature and also for Windows. 222 | 223 |

Building Lua on other systems

224 | 225 |

226 | If you're not using the usual Unix tools, then the instructions for 227 | building Lua depend on the compiler you use. You'll need to create 228 | projects (or whatever your compiler uses) for building the library, 229 | the interpreter, and the compiler, as follows: 230 | 231 |

232 |
233 | library: 234 |
235 | lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c 236 | lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c 237 | ltm.c lundump.c lvm.c lzio.c 238 | lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c 239 | lmathlib.c loslib.c lstrlib.c ltablib.c loadlib.c linit.c 240 |
241 | interpreter: 242 |
243 | library, lua.c 244 |
245 | compiler: 246 |
247 | library, luac.c 248 |
249 | 250 |

251 | To use Lua as a library in your own programs you'll need to know how to 252 | create and use libraries with your compiler. Moreover, to dynamically load 253 | C libraries for Lua you'll need to know how to create dynamic libraries 254 | and you'll need to make sure that the Lua API functions are accessible to 255 | those dynamic libraries — but don't link the Lua library 256 | into each dynamic library. For Unix, we recommend that the Lua library 257 | be linked statically into the host program and its symbols exported for 258 | dynamic linking; src/Makefile does this for the Lua interpreter. 259 | For Windows, we recommend that the Lua library be a DLL. 260 | In all cases, the compiler luac should be linked statically. 261 | 262 |

263 | As mentioned above, you may edit src/luaconf.h to customize 264 | some features before building Lua. 265 | 266 |

Changes since Lua 5.1

267 | 268 |

269 | Here are the main changes introduced in Lua 5.2. 270 | The 271 | reference manual 272 | lists the 273 | incompatibilities that had to be introduced. 274 | 275 |

Main changes

276 | 286 | 287 | Here are the other changes introduced in Lua 5.2: 288 |

Language

289 | 300 | 301 |

Libraries

302 | 322 | 323 |

C API

324 | 346 | 347 |

Implementation

348 | 356 | 357 |

Lua standalone interpreter

358 | 362 | 363 |

License

364 | 365 | [osi certified] 366 | 367 | 368 |

369 | Lua is free software distributed under the terms of the 370 | MIT license 371 | reproduced below; 372 | it may be used for any purpose, including commercial purposes, 373 | at absolutely no cost without having to ask us. 374 | 375 | The only requirement is that if you do use Lua, 376 | then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation. 377 | 378 | For details, see 379 | this. 380 | 381 |

382 | Copyright © 1994–2015 Lua.org, PUC-Rio. 383 | 384 |

385 | Permission is hereby granted, free of charge, to any person obtaining a copy 386 | of this software and associated documentation files (the "Software"), to deal 387 | in the Software without restriction, including without limitation the rights 388 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 389 | copies of the Software, and to permit persons to whom the Software is 390 | furnished to do so, subject to the following conditions: 391 | 392 |

393 | The above copyright notice and this permission notice shall be included in 394 | all copies or substantial portions of the Software. 395 | 396 |

397 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 398 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 399 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 400 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 401 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 402 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 403 | THE SOFTWARE. 404 |

405 |

406 | 407 |


408 | 409 | Last update: 410 | Mon Feb 23 22:25:08 BRT 2015 411 | 412 | 415 | 416 | 417 | 418 | -------------------------------------------------------------------------------- /doc/en-us/53/contents.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Lua 5.3 Reference Manual - contents 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

13 | Lua 14 | Lua 5.3 Reference Manual 15 |

16 | 17 |

18 | The reference manual is the official definition of the Lua language. 19 |
20 | For a complete introduction to Lua programming, see the book 21 | Programming in Lua. 22 | 23 |

32 | 33 |

34 | 35 | Copyright © 2015–2020 Lua.org, PUC-Rio. 36 | Freely available under the terms of the 37 | Lua license. 38 | 39 | 40 |

Contents

41 | 136 | 137 |

Index

138 | 139 | 140 | 225 | 362 | 498 | 638 | 639 | 640 | 641 | 645 | 648 | 649 | 650 | 651 | -------------------------------------------------------------------------------- /doc/en-us/53/index.css: -------------------------------------------------------------------------------- 1 | ul { 2 | list-style-type: none ; 3 | } 4 | 5 | ul.contents { 6 | padding: 0 ; 7 | } 8 | 9 | table { 10 | border: none ; 11 | border-spacing: 0 ; 12 | border-collapse: collapse ; 13 | } 14 | 15 | td { 16 | vertical-align: top ; 17 | padding: 0 ; 18 | text-align: left ; 19 | line-height: 1.25 ; 20 | width: 15% ; 21 | } 22 | -------------------------------------------------------------------------------- /doc/en-us/53/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LuaLS/vscode-lua-doc/fd6c8cd04787764938368baeb3e34d06d203313d/doc/en-us/53/logo.gif -------------------------------------------------------------------------------- /doc/en-us/53/lua.css: -------------------------------------------------------------------------------- 1 | html { 2 | background-color: #F8F8F8 ; 3 | } 4 | 5 | body { 6 | background-color: #FFFFFF ; 7 | color: #000000 ; 8 | font-family: Helvetica, Arial, sans-serif ; 9 | text-align: justify ; 10 | line-height: 1.25 ; 11 | margin: 16px auto ; 12 | padding: 32px ; 13 | border: solid #ccc 1px ; 14 | border-radius: 20px ; 15 | max-width: 70em ; 16 | width: 90% ; 17 | } 18 | 19 | h1, h2, h3, h4 { 20 | color: #000080 ; 21 | font-family: Verdana, Geneva, sans-serif ; 22 | font-weight: normal ; 23 | font-style: normal ; 24 | text-align: left ; 25 | } 26 | 27 | h1 { 28 | font-size: 28pt ; 29 | } 30 | 31 | h1 img { 32 | vertical-align: text-bottom ; 33 | } 34 | 35 | h2:before { 36 | content: "\2756" ; 37 | padding-right: 0.5em ; 38 | } 39 | 40 | a { 41 | text-decoration: none ; 42 | } 43 | 44 | a:link { 45 | color: #000080 ; 46 | } 47 | 48 | a:link:hover, a:visited:hover { 49 | background-color: #D0D0FF ; 50 | color: #000080 ; 51 | border-radius: 4px ; 52 | } 53 | 54 | a:link:active, a:visited:active { 55 | color: #FF0000 ; 56 | } 57 | 58 | div.menubar { 59 | padding-bottom: 0.5em ; 60 | } 61 | 62 | p.menubar { 63 | margin-left: 2.5em ; 64 | } 65 | 66 | .menubar a:hover { 67 | margin: -3px -3px -3px -3px ; 68 | padding: 3px 3px 3px 3px ; 69 | border-radius: 4px ; 70 | } 71 | 72 | :target { 73 | background-color: #F0F0F0 ; 74 | margin: -8px ; 75 | padding: 8px ; 76 | border-radius: 8px ; 77 | outline: none ; 78 | } 79 | 80 | hr { 81 | display: none ; 82 | } 83 | 84 | table hr { 85 | background-color: #a0a0a0 ; 86 | color: #a0a0a0 ; 87 | border: 0 ; 88 | height: 1px ; 89 | display: block ; 90 | } 91 | 92 | .footer { 93 | color: gray ; 94 | font-size: x-small ; 95 | text-transform: lowercase ; 96 | } 97 | 98 | input[type=text] { 99 | border: solid #a0a0a0 2px ; 100 | border-radius: 2em ; 101 | background-image: url('images/search.png') ; 102 | background-repeat: no-repeat ; 103 | background-position: 4px center ; 104 | padding-left: 20px ; 105 | height: 2em ; 106 | } 107 | 108 | pre.session { 109 | background-color: #F8F8F8 ; 110 | padding: 1em ; 111 | border-radius: 8px ; 112 | } 113 | 114 | table { 115 | border: none ; 116 | border-spacing: 0 ; 117 | border-collapse: collapse ; 118 | } 119 | 120 | td { 121 | padding: 0 ; 122 | margin: 0 ; 123 | } 124 | 125 | td.gutter { 126 | width: 4% ; 127 | } 128 | 129 | table.columns td { 130 | vertical-align: top ; 131 | padding-bottom: 1em ; 132 | text-align: justify ; 133 | line-height: 1.25 ; 134 | } 135 | 136 | table.book td { 137 | vertical-align: top ; 138 | } 139 | 140 | table.book td.cover { 141 | padding-right: 1em ; 142 | } 143 | 144 | table.book img { 145 | border: solid #000080 1px ; 146 | } 147 | 148 | table.book span { 149 | font-size: small ; 150 | text-align: left ; 151 | display: block ; 152 | margin-top: 0.25em ; 153 | } 154 | 155 | p.logos a:link:hover, p.logos a:visited:hover { 156 | background-color: inherit ; 157 | } 158 | 159 | img { 160 | background-color: white ; 161 | } 162 | -------------------------------------------------------------------------------- /doc/en-us/53/manual.css: -------------------------------------------------------------------------------- 1 | h3 code { 2 | font-family: inherit ; 3 | font-size: inherit ; 4 | } 5 | 6 | pre, code { 7 | font-size: 12pt ; 8 | } 9 | 10 | span.apii { 11 | color: gray ; 12 | float: right ; 13 | font-family: inherit ; 14 | font-style: normal ; 15 | font-size: small ; 16 | } 17 | 18 | h2:before { 19 | content: "" ; 20 | padding-right: 0em ; 21 | } 22 | -------------------------------------------------------------------------------- /doc/en-us/53/osi-certified-72x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LuaLS/vscode-lua-doc/fd6c8cd04787764938368baeb3e34d06d203313d/doc/en-us/53/osi-certified-72x60.png -------------------------------------------------------------------------------- /doc/en-us/53/readme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Lua 5.3 readme 5 | 6 | 7 | 27 | 28 | 29 | 30 | 31 |

32 | Lua 33 | Welcome to Lua 5.3 34 |

35 | 36 | 47 | 48 |

About Lua

49 |

50 | Lua is a powerful, fast, lightweight, embeddable scripting language 51 | developed by a 52 | team 53 | at 54 | PUC-Rio, 55 | the Pontifical Catholic University of Rio de Janeiro in Brazil. 56 | Lua is 57 | free software 58 | used in many products and projects around the world. 59 | 60 |

61 | Lua's 62 | official web site 63 | provides complete information 64 | about Lua, 65 | including 66 | an 67 | executive summary 68 | and 69 | updated 70 | documentation, 71 | especially the 72 | reference manual, 73 | which may differ slightly from the 74 | local copy 75 | distributed in this package. 76 | 77 |

Installing Lua

78 |

79 | Lua is distributed in 80 | source 81 | form. 82 | You need to build it before using it. 83 | Building Lua should be straightforward 84 | because 85 | Lua is implemented in pure ANSI C and compiles unmodified in all known 86 | platforms that have an ANSI C compiler. 87 | Lua also compiles unmodified as C++. 88 | The instructions given below for building Lua are for Unix-like platforms. 89 | See also 90 | instructions for other systems 91 | and 92 | customization options. 93 | 94 |

95 | If you don't have the time or the inclination to compile Lua yourself, 96 | get a binary from 97 | LuaBinaries. 98 | Try also 99 | LuaDist, 100 | a multi-platform distribution of Lua that includes batteries. 101 | 102 |

Building Lua

103 |

104 | In most Unix-like platforms, simply do "make" with a suitable target. 105 | Here are the details. 106 | 107 |

    108 |
  1. 109 | Open a terminal window and move to 110 | the top-level directory, which is named lua-5.3.6. 111 | The Makefile there controls both the build process and the installation process. 112 |

    113 |

  2. 114 | Do "make" and see if your platform is listed. 115 | The platforms currently supported are: 116 |

    117 |

    118 | aix bsd c89 freebsd generic linux macosx mingw posix solaris 119 |

    120 |

    121 | If your platform is listed, just do "make xxx", where xxx 122 | is your platform name. 123 |

    124 | If your platform is not listed, try the closest one or posix, generic, 125 | c89, in this order. 126 |

    127 |

  3. 128 | The compilation takes only a few moments 129 | and produces three files in the src directory: 130 | lua (the interpreter), 131 | luac (the compiler), 132 | and liblua.a (the library). 133 |

    134 |

  4. 135 | To check that Lua has been built correctly, do "make test" 136 | after building Lua. This will run the interpreter and print its version. 137 |
138 |

139 | If you're running Linux and get compilation errors, 140 | make sure you have installed the readline development package 141 | (which is probably named libreadline-dev or readline-devel). 142 | If you get link errors after that, 143 | then try "make linux MYLIBS=-ltermcap". 144 | 145 |

Installing Lua

146 |

147 | Once you have built Lua, you may want to install it in an official 148 | place in your system. In this case, do "make install". The official 149 | place and the way to install files are defined in the Makefile. You'll 150 | probably need the right permissions to install files. 151 | 152 |

153 | To build and install Lua in one step, do "make xxx install", 154 | where xxx is your platform name. 155 | 156 |

157 | To install Lua locally, do "make local". 158 | This will create a directory install with subdirectories 159 | bin, include, lib, man, share, 160 | and install Lua as listed below. 161 | 162 | To install Lua locally, but in some other directory, do 163 | "make install INSTALL_TOP=xxx", where xxx is your chosen directory. 164 | The installation starts in the src and doc directories, 165 | so take care if INSTALL_TOP is not an absolute path. 166 | 167 |

168 |
169 | bin: 170 |
171 | lua luac 172 |
173 | include: 174 |
175 | lua.h luaconf.h lualib.h lauxlib.h lua.hpp 176 |
177 | lib: 178 |
179 | liblua.a 180 |
181 | man/man1: 182 |
183 | lua.1 luac.1 184 |
185 | 186 |

187 | These are the only directories you need for development. 188 | If you only want to run Lua programs, 189 | you only need the files in bin and man. 190 | The files in include and lib are needed for 191 | embedding Lua in C or C++ programs. 192 | 193 |

Customization

194 |

195 | Three kinds of things can be customized by editing a file: 196 |

201 | 202 |

203 | You don't actually need to edit the Makefiles because you may set the 204 | relevant variables in the command line when invoking make. 205 | Nevertheless, it's probably best to edit and save the Makefiles to 206 | record the changes you've made. 207 | 208 |

209 | On the other hand, if you need to customize some Lua features, you'll need 210 | to edit src/luaconf.h before building and installing Lua. 211 | The edited file will be the one installed, and 212 | it will be used by any Lua clients that you build, to ensure consistency. 213 | Further customization is available to experts by editing the Lua sources. 214 | 215 |

Building Lua on other systems

216 |

217 | If you're not using the usual Unix tools, then the instructions for 218 | building Lua depend on the compiler you use. You'll need to create 219 | projects (or whatever your compiler uses) for building the library, 220 | the interpreter, and the compiler, as follows: 221 | 222 |

223 |
224 | library: 225 |
226 | lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c 227 | lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c 228 | ltm.c lundump.c lvm.c lzio.c 229 | lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c 230 | lmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c 231 |
232 | interpreter: 233 |
234 | library, lua.c 235 |
236 | compiler: 237 |
238 | library, luac.c 239 |
240 | 241 |

242 | To use Lua as a library in your own programs you'll need to know how to 243 | create and use libraries with your compiler. Moreover, to dynamically load 244 | C libraries for Lua you'll need to know how to create dynamic libraries 245 | and you'll need to make sure that the Lua API functions are accessible to 246 | those dynamic libraries — but don't link the Lua library 247 | into each dynamic library. For Unix, we recommend that the Lua library 248 | be linked statically into the host program and its symbols exported for 249 | dynamic linking; src/Makefile does this for the Lua interpreter. 250 | For Windows, we recommend that the Lua library be a DLL. 251 | In all cases, the compiler luac should be linked statically. 252 | 253 |

254 | As mentioned above, you may edit src/luaconf.h to customize 255 | some features before building Lua. 256 | 257 |

Changes since Lua 5.2

258 |

259 | Here are the main changes introduced in Lua 5.3. 260 | The 261 | reference manual 262 | lists the 263 | incompatibilities that had to be introduced. 264 | 265 |

Main changes

266 | 274 | 275 | Here are the other changes introduced in Lua 5.3: 276 |

Language

277 | 282 | 283 |

Libraries

284 | 293 | 294 |

C API

295 | 306 | 307 |

Lua standalone interpreter

308 | 312 | 313 |

License

314 |

315 | 316 | [osi certified] 317 | 318 | Lua is free software distributed under the terms of the 319 | MIT license 320 | reproduced below; 321 | it may be used for any purpose, including commercial purposes, 322 | at absolutely no cost without having to ask us. 323 | 324 | The only requirement is that if you do use Lua, 325 | then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation. 326 | 327 | For details, see 328 | this. 329 | 330 |

331 | Copyright © 1994–2020 Lua.org, PUC-Rio. 332 | 333 |

334 | Permission is hereby granted, free of charge, to any person obtaining a copy 335 | of this software and associated documentation files (the "Software"), to deal 336 | in the Software without restriction, including without limitation the rights 337 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 338 | copies of the Software, and to permit persons to whom the Software is 339 | furnished to do so, subject to the following conditions: 340 | 341 |

342 | The above copyright notice and this permission notice shall be included in 343 | all copies or substantial portions of the Software. 344 | 345 |

346 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 347 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 348 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 349 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 350 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 351 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 352 | THE SOFTWARE. 353 |

354 |

355 | 356 |

360 | 363 | 364 | 365 | 366 | -------------------------------------------------------------------------------- /doc/en-us/54/contents.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Lua 5.4 Reference Manual - contents 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

13 | Lua 14 | Lua 5.4 Reference Manual 15 |

16 | 17 |

18 | The reference manual is the official definition of the Lua language. 19 |
20 | For a complete introduction to Lua programming, see the book 21 | Programming in Lua. 22 | 23 |

32 | 33 |

34 | 35 | Copyright © 2020–2023 Lua.org, PUC-Rio. 36 | Freely available under the terms of the 37 | Lua license. 38 | 39 | 40 |

Contents

41 | 147 | 148 |

Index

149 | 150 | 151 | 238 | 376 | 518 | 666 | 667 | 668 | 669 | 673 | 676 | 677 | 678 | 679 | -------------------------------------------------------------------------------- /doc/en-us/54/index.css: -------------------------------------------------------------------------------- 1 | ul { 2 | list-style-type: none ; 3 | } 4 | 5 | ul.contents { 6 | padding: 0 ; 7 | } 8 | 9 | table { 10 | border: none ; 11 | border-spacing: 0 ; 12 | border-collapse: collapse ; 13 | } 14 | 15 | td { 16 | vertical-align: top ; 17 | padding: 0 ; 18 | text-align: left ; 19 | line-height: 1.25 ; 20 | width: 15% ; 21 | } 22 | -------------------------------------------------------------------------------- /doc/en-us/54/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LuaLS/vscode-lua-doc/fd6c8cd04787764938368baeb3e34d06d203313d/doc/en-us/54/logo.gif -------------------------------------------------------------------------------- /doc/en-us/54/lua.css: -------------------------------------------------------------------------------- 1 | html { 2 | background-color: #F8F8F8 ; 3 | } 4 | 5 | body { 6 | background-color: #FFFFFF ; 7 | color: #000000 ; 8 | font-family: Helvetica, Arial, sans-serif ; 9 | text-align: justify ; 10 | line-height: 1.25 ; 11 | margin: 16px auto ; 12 | padding: 32px ; 13 | border: solid #ccc 1px ; 14 | border-radius: 20px ; 15 | max-width: 70em ; 16 | width: 90% ; 17 | } 18 | 19 | h1, h2, h3, h4 { 20 | color: #000080 ; 21 | font-family: Verdana, Geneva, sans-serif ; 22 | font-weight: normal ; 23 | font-style: normal ; 24 | text-align: left ; 25 | } 26 | 27 | h1 { 28 | font-size: 28pt ; 29 | } 30 | 31 | h1 img { 32 | vertical-align: text-bottom ; 33 | } 34 | 35 | h2:before { 36 | content: "\2756" ; 37 | padding-right: 0.5em ; 38 | } 39 | 40 | a { 41 | text-decoration: none ; 42 | } 43 | 44 | a:link { 45 | color: #000080 ; 46 | } 47 | 48 | a:link:hover, a:visited:hover { 49 | background-color: #D0D0FF ; 50 | color: #000080 ; 51 | border-radius: 4px ; 52 | } 53 | 54 | a:link:active, a:visited:active { 55 | color: #FF0000 ; 56 | } 57 | 58 | div.menubar { 59 | padding-bottom: 0.5em ; 60 | } 61 | 62 | p.menubar { 63 | margin-left: 2.5em ; 64 | } 65 | 66 | .menubar a:hover { 67 | margin: -3px -3px -3px -3px ; 68 | padding: 3px 3px 3px 3px ; 69 | border-radius: 4px ; 70 | } 71 | 72 | :target { 73 | background-color: #F0F0F0 ; 74 | margin: -8px ; 75 | padding: 8px ; 76 | border-radius: 8px ; 77 | outline: none ; 78 | } 79 | 80 | hr { 81 | display: none ; 82 | } 83 | 84 | table hr { 85 | background-color: #a0a0a0 ; 86 | color: #a0a0a0 ; 87 | border: 0 ; 88 | height: 1px ; 89 | display: block ; 90 | } 91 | 92 | .footer { 93 | color: gray ; 94 | font-size: x-small ; 95 | text-transform: lowercase ; 96 | } 97 | 98 | input[type=text] { 99 | border: solid #a0a0a0 2px ; 100 | border-radius: 2em ; 101 | background-image: url('images/search.png') ; 102 | background-repeat: no-repeat ; 103 | background-position: 4px center ; 104 | padding-left: 20px ; 105 | height: 2em ; 106 | } 107 | 108 | pre.session { 109 | background-color: #F8F8F8 ; 110 | padding: 1em ; 111 | border-radius: 8px ; 112 | } 113 | 114 | table { 115 | border: none ; 116 | border-spacing: 0 ; 117 | border-collapse: collapse ; 118 | } 119 | 120 | td { 121 | padding: 0 ; 122 | margin: 0 ; 123 | } 124 | 125 | td.gutter { 126 | width: 4% ; 127 | } 128 | 129 | table.columns td { 130 | vertical-align: top ; 131 | padding-bottom: 1em ; 132 | text-align: justify ; 133 | line-height: 1.25 ; 134 | } 135 | 136 | table.book td { 137 | vertical-align: top ; 138 | } 139 | 140 | table.book td.cover { 141 | padding-right: 1em ; 142 | } 143 | 144 | table.book img { 145 | border: solid #000080 1px ; 146 | } 147 | 148 | table.book span { 149 | font-size: small ; 150 | text-align: left ; 151 | display: block ; 152 | margin-top: 0.25em ; 153 | } 154 | 155 | p.logos a:link:hover, p.logos a:visited:hover { 156 | background-color: inherit ; 157 | } 158 | 159 | img { 160 | background-color: white ; 161 | } 162 | -------------------------------------------------------------------------------- /doc/en-us/54/manual.css: -------------------------------------------------------------------------------- 1 | h3 code { 2 | font-family: inherit ; 3 | font-size: inherit ; 4 | } 5 | 6 | pre, code { 7 | font-size: 12pt ; 8 | } 9 | 10 | span.apii { 11 | color: gray ; 12 | float: right ; 13 | font-family: inherit ; 14 | font-style: normal ; 15 | font-size: small ; 16 | } 17 | 18 | h2:before { 19 | content: "" ; 20 | padding-right: 0em ; 21 | } 22 | -------------------------------------------------------------------------------- /doc/en-us/54/osi-certified-72x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LuaLS/vscode-lua-doc/fd6c8cd04787764938368baeb3e34d06d203313d/doc/en-us/54/osi-certified-72x60.png -------------------------------------------------------------------------------- /doc/en-us/54/readme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Lua 5.4 readme 5 | 6 | 7 | 27 | 28 | 29 | 30 | 31 |

32 | Lua 33 | Welcome to Lua 5.4 34 |

35 | 36 | 47 | 48 |

About Lua

49 |

50 | Lua is a powerful, efficient, lightweight, embeddable scripting language 51 | developed by a 52 | team 53 | at 54 | PUC-Rio, 55 | the Pontifical Catholic University of Rio de Janeiro in Brazil. 56 | Lua is 57 | free software 58 | used in 59 | many products and projects 60 | around the world. 61 | 62 |

63 | Lua's 64 | official web site 65 | provides complete information 66 | about Lua, 67 | including 68 | an 69 | executive summary 70 | and 71 | updated 72 | documentation, 73 | especially the 74 | reference manual, 75 | which may differ slightly from the 76 | local copy 77 | distributed in this package. 78 | 79 |

Installing Lua

80 |

81 | Lua is distributed in 82 | source 83 | form. 84 | You need to build it before using it. 85 | Building Lua should be straightforward 86 | because 87 | Lua is implemented in pure ANSI C and compiles unmodified in all known 88 | platforms that have an ANSI C compiler. 89 | Lua also compiles unmodified as C++. 90 | The instructions given below for building Lua are for Unix-like platforms, 91 | such as Linux and Mac OS X. 92 | See also 93 | instructions for other systems 94 | and 95 | customization options. 96 | 97 |

98 | If you don't have the time or the inclination to compile Lua yourself, 99 | get a binary from 100 | LuaBinaries. 101 | 102 |

Building Lua

103 |

104 | In most common Unix-like platforms, simply do "make". 105 | Here are the details. 106 | 107 |

    108 |
  1. 109 | Open a terminal window and move to 110 | the top-level directory, which is named lua-5.4.6. 111 | The Makefile there controls both the build process and the installation process. 112 |

    113 |

  2. 114 | Do "make". The Makefile will guess your platform and build Lua for it. 115 |

    116 |

  3. 117 | If the guess failed, do "make help" and see if your platform is listed. 118 | The platforms currently supported are: 119 |

    120 |

    121 | guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris 122 |

    123 |

    124 | If your platform is listed, just do "make xxx", where xxx 125 | is your platform name. 126 |

    127 | If your platform is not listed, try the closest one or posix, generic, 128 | c89, in this order. 129 |

    130 |

  4. 131 | The compilation takes only a few moments 132 | and produces three files in the src directory: 133 | lua (the interpreter), 134 | luac (the compiler), 135 | and liblua.a (the library). 136 |

    137 |

  5. 138 | To check that Lua has been built correctly, do "make test" 139 | after building Lua. This will run the interpreter and print its version. 140 |
141 |

142 | If you're running Linux, try "make linux-readline" to build the interactive Lua interpreter with handy line-editing and history capabilities. 143 | If you get compilation errors, 144 | make sure you have installed the readline development package 145 | (which is probably named libreadline-dev or readline-devel). 146 | If you get link errors after that, 147 | then try "make linux-readline MYLIBS=-ltermcap". 148 | 149 |

Installing Lua

150 |

151 | Once you have built Lua, you may want to install it in an official 152 | place in your system. In this case, do "make install". The official 153 | place and the way to install files are defined in the Makefile. You'll 154 | probably need the right permissions to install files, and so may need to do "sudo make install". 155 | 156 |

157 | To build and install Lua in one step, do "make all install", 158 | or "make xxx install", 159 | where xxx is your platform name. 160 | 161 |

162 | To install Lua locally after building it, do "make local". 163 | This will create a directory install with subdirectories 164 | bin, include, lib, man, share, 165 | and install Lua as listed below. 166 | 167 | To install Lua locally, but in some other directory, do 168 | "make install INSTALL_TOP=xxx", where xxx is your chosen directory. 169 | The installation starts in the src and doc directories, 170 | so take care if INSTALL_TOP is not an absolute path. 171 | 172 |

173 |
174 | bin: 175 |
176 | lua luac 177 |
178 | include: 179 |
180 | lua.h luaconf.h lualib.h lauxlib.h lua.hpp 181 |
182 | lib: 183 |
184 | liblua.a 185 |
186 | man/man1: 187 |
188 | lua.1 luac.1 189 |
190 | 191 |

192 | These are the only directories you need for development. 193 | If you only want to run Lua programs, 194 | you only need the files in bin and man. 195 | The files in include and lib are needed for 196 | embedding Lua in C or C++ programs. 197 | 198 |

Customization

199 |

200 | Three kinds of things can be customized by editing a file: 201 |

206 | 207 |

208 | You don't actually need to edit the Makefiles because you may set the 209 | relevant variables in the command line when invoking make. 210 | Nevertheless, it's probably best to edit and save the Makefiles to 211 | record the changes you've made. 212 | 213 |

214 | On the other hand, if you need to customize some Lua features, you'll need 215 | to edit src/luaconf.h before building and installing Lua. 216 | The edited file will be the one installed, and 217 | it will be used by any Lua clients that you build, to ensure consistency. 218 | Further customization is available to experts by editing the Lua sources. 219 | 220 |

Building Lua on other systems

221 |

222 | If you're not using the usual Unix tools, then the instructions for 223 | building Lua depend on the compiler you use. You'll need to create 224 | projects (or whatever your compiler uses) for building the library, 225 | the interpreter, and the compiler, as follows: 226 | 227 |

228 |
229 | library: 230 |
231 | lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c 232 | lauxlib.c lbaselib.c lcorolib.c ldblib.c liolib.c lmathlib.c loadlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c linit.c 233 |
234 | interpreter: 235 |
236 | library, lua.c 237 |
238 | compiler: 239 |
240 | library, luac.c 241 |
242 | 243 |

244 | To use Lua as a library in your own programs, you'll need to know how to 245 | create and use libraries with your compiler. Moreover, to dynamically load 246 | C libraries for Lua, you'll need to know how to create dynamic libraries 247 | and you'll need to make sure that the Lua API functions are accessible to 248 | those dynamic libraries — but don't link the Lua library 249 | into each dynamic library. For Unix, we recommend that the Lua library 250 | be linked statically into the host program and its symbols exported for 251 | dynamic linking; src/Makefile does this for the Lua interpreter. 252 | For Windows, we recommend that the Lua library be a DLL. 253 | In all cases, the compiler luac should be linked statically. 254 | 255 |

256 | As mentioned above, you may edit src/luaconf.h to customize 257 | some features before building Lua. 258 | 259 |

Changes since Lua 5.3

260 |

261 | Here are the main changes introduced in Lua 5.4. 262 | The 263 | reference manual 264 | lists the 265 | incompatibilities that had to be introduced. 266 | 267 |

Main changes

268 | 284 | 285 |

License

286 |

287 | 288 | [osi certified] 289 | 290 | Lua is free software distributed under the terms of the 291 | MIT license 292 | reproduced below; 293 | it may be used for any purpose, including commercial purposes, 294 | at absolutely no cost without having to ask us. 295 | 296 | The only requirement is that if you do use Lua, 297 | then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation. 298 | 299 | For details, see 300 | this. 301 | 302 |

303 | Copyright © 1994–2023 Lua.org, PUC-Rio. 304 | 305 |

306 | Permission is hereby granted, free of charge, to any person obtaining a copy 307 | of this software and associated documentation files (the "Software"), to deal 308 | in the Software without restriction, including without limitation the rights 309 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 310 | copies of the Software, and to permit persons to whom the Software is 311 | furnished to do so, subject to the following conditions: 312 | 313 |

314 | The above copyright notice and this permission notice shall be included in 315 | all copies or substantial portions of the Software. 316 | 317 |

318 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 319 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 320 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 321 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 322 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 323 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 324 | THE SOFTWARE. 325 |

326 |

327 | 328 |

332 | 335 | 336 | 337 | 338 | -------------------------------------------------------------------------------- /extension.js: -------------------------------------------------------------------------------- 1 | const vscode = require('vscode'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | 5 | var currentPanel; 6 | 7 | function compileOther(srcPath, dstPath, name) { 8 | fs.copyFileSync(path.join(srcPath, name), path.join(dstPath, name)); 9 | } 10 | 11 | function compileCss(srcPath, dstPath, name) { 12 | let css = fs.readFileSync(path.join(srcPath, name), 'utf8'); 13 | css = css.split('\n').map(function (line) { 14 | if (line.match('color')) { 15 | return ''; 16 | } 17 | return line; 18 | }).join('\n'); 19 | fs.writeFileSync(path.join(dstPath, name), css); 20 | } 21 | 22 | function compileHtml(srcPath, dstPath, language, version, name) { 23 | let html = fs.readFileSync(path.join(srcPath, name), 'utf8'); 24 | html = html.replace(/(<\/body>)/i, ` 25 | 80 | $1 81 | `); 82 | fs.writeFileSync(path.join(dstPath, name), html); 83 | } 84 | 85 | function compile(workPath, language, version, srcPath, dstPath) { 86 | fs.mkdirSync(dstPath, { recursive: true }); 87 | fs.readdirSync(srcPath).forEach(function (name) { 88 | const file = path.join(srcPath, name); 89 | const stat = fs.statSync(file); 90 | if (!stat || !stat.isFile()) { 91 | return; 92 | } 93 | const extname = path.extname(file); 94 | if (".html" == extname) { 95 | compileHtml(srcPath, dstPath, language, version, name); 96 | } 97 | else if (".css" == extname) { 98 | compileCss(path.join(workPath, 'doc', 'en-us', '54'), dstPath, name); 99 | } 100 | else { 101 | compileOther(srcPath, dstPath, name); 102 | } 103 | }); 104 | } 105 | 106 | function needCompile(workPath, dstPath) { 107 | const cfg = path.join(dstPath, '.compiled'); 108 | if (!fs.existsSync(cfg)) { 109 | return true; 110 | } 111 | return (workPath != fs.readFileSync(cfg, 'utf8')); 112 | } 113 | 114 | function checkAndCompile(workPath, language, version) { 115 | const srcPath = path.join(workPath, 'doc', language, version); 116 | const dstPath = path.join(workPath, 'out', language, version); 117 | if (needCompile(workPath, dstPath)) { 118 | if (!fs.existsSync(srcPath)) { 119 | currentPanel.title = 'Error'; 120 | currentPanel.webview.html = ` 121 | 122 | 123 | 124 | 125 |

Not Found doc/${language}/${version}/

126 | 127 | `; 128 | return false; 129 | } 130 | compile(workPath, language, version, srcPath, dstPath); 131 | fs.writeFileSync(path.join(dstPath, '.compiled'), workPath); 132 | } 133 | currentPanel._language = language; 134 | currentPanel._version = version; 135 | return true 136 | } 137 | 138 | function openHtml(workPath, file, initmsg) { 139 | const language = currentPanel._language; 140 | const version = currentPanel._version; 141 | const htmlPath = path.join(workPath, 'out', language, version, file); 142 | if (currentPanel._file == htmlPath) { 143 | currentPanel.webview.postMessage(initmsg); 144 | return; 145 | } 146 | currentPanel._file = htmlPath; 147 | if (!fs.existsSync(htmlPath)) { 148 | currentPanel.title = 'Error'; 149 | currentPanel.webview.html = ` 150 | 151 | 152 | 153 | 154 |

Not Found doc/${language}/${version}/${file}

155 | 156 | `; 157 | return; 158 | } 159 | let html = fs.readFileSync(htmlPath, 'utf8'); 160 | currentPanel.title = html.match(/(.*?)<\/title>/i)[1]; 161 | 162 | const srcPath = path.join(workPath, 'doc', language, version); 163 | const dstPath = path.join(workPath, 'out', language, version); 164 | fs.readdirSync(srcPath).forEach(function (name) { 165 | const file = path.join(srcPath, name); 166 | const stat = fs.statSync(file); 167 | if (stat && stat.isFile()) { 168 | if (".html" != path.extname(file)) { 169 | const uri = currentPanel.webview.asWebviewUri(vscode.Uri.file(path.join(dstPath, name))); 170 | html = html.replace(name, uri); 171 | } 172 | } 173 | }); 174 | 175 | currentPanel.webview.html = html; 176 | currentPanel.webview.initmsg = initmsg; 177 | } 178 | 179 | function parseUri(uri) { 180 | const l = uri.split(/[\/#]/g); 181 | return { 182 | language: l[0], 183 | version: l[1], 184 | file: l[2], 185 | anchor: l[3], 186 | }; 187 | } 188 | 189 | function getViewColumn(reveal) { 190 | if (vscode.window.activeTextEditor) { 191 | if (vscode.window.activeTextEditor.viewColumn == vscode.ViewColumn.One) { 192 | return vscode.ViewColumn.Two; 193 | } 194 | return vscode.window.activeTextEditor.viewColumn; 195 | } 196 | if (reveal) { 197 | return undefined; 198 | } 199 | return vscode.ViewColumn.One; 200 | } 201 | 202 | function registerMessage(workPath, webview, disposables) { 203 | webview.onDidReceiveMessage( 204 | message => { 205 | switch (message.command) { 206 | case 'loaded': 207 | if (webview.initmsg !== undefined) { 208 | webview.postMessage(webview.initmsg); 209 | webview.initmsg = undefined; 210 | } 211 | return; 212 | case 'goto': 213 | const uri = message.uri.split("#"); 214 | if (uri[1]) { 215 | openHtml(workPath, uri[0], { command: 'goto', anchor: uri[1] }); 216 | } 217 | else { 218 | openHtml(workPath, uri[0]); 219 | } 220 | return; 221 | } 222 | }, 223 | null, 224 | disposables 225 | ); 226 | } 227 | 228 | function createPanel(workPath, disposables, viewType) { 229 | const options = { 230 | enableScripts: true, 231 | enableFindWidget: true, 232 | retainContextWhenHidden: true, 233 | }; 234 | let panel = vscode.window.createWebviewPanel(viewType, '', { viewColumn: getViewColumn(false), preserveFocus: true }, options); 235 | registerMessage(workPath, panel.webview, disposables); 236 | panel.onDidDispose( 237 | () => { 238 | currentPanel = undefined; 239 | }, 240 | null, 241 | disposables 242 | ); 243 | return panel; 244 | } 245 | 246 | function createWebviewPanel(workPath, disposables, viewType, uri) { 247 | if (currentPanel) { 248 | try { 249 | currentPanel.reveal(getViewColumn(true), true); 250 | } catch (error) { 251 | currentPanel = undefined; 252 | } 253 | } 254 | if (!currentPanel) { 255 | currentPanel = createPanel(workPath, disposables, viewType); 256 | } 257 | const args = parseUri(uri); 258 | if (!checkAndCompile(workPath, args.language, args.version)) { 259 | return; 260 | } 261 | if (args.anchor) { 262 | openHtml(workPath, args.file, { command: 'goto', anchor: args.anchor }); 263 | } 264 | else { 265 | openHtml(workPath, args.file); 266 | } 267 | } 268 | 269 | function revealWebviewPanel(workPath, disposables, webviewPanel, state) { 270 | if (!state) { 271 | webviewPanel.dispose(); 272 | return; 273 | } 274 | currentPanel = webviewPanel; 275 | registerMessage(workPath, currentPanel.webview, disposables); 276 | if (!checkAndCompile(workPath, state.language, state.version)) { 277 | return; 278 | } 279 | openHtml(workPath, state.file, { 280 | command: 'scrollTo', 281 | top: state.scrollTop, 282 | left: state.scrollLeft, 283 | }); 284 | } 285 | 286 | function activateLuaDoc(workPath, disposables, LuaDoc) { 287 | disposables.push(vscode.commands.registerCommand(LuaDoc.OpenCommand, (uri) => { 288 | try { 289 | createWebviewPanel(workPath, disposables, LuaDoc.ViewType, uri || "en-us/54/readme.html"); 290 | } catch (error) { 291 | console.error(error) 292 | } 293 | })); 294 | 295 | vscode.window.registerWebviewPanelSerializer(LuaDoc.ViewType, { 296 | deserializeWebviewPanel(webviewPanel, state) { 297 | try { 298 | revealWebviewPanel(workPath, disposables, webviewPanel, state) 299 | } catch (error) { 300 | console.error(error) 301 | } 302 | } 303 | }); 304 | } 305 | 306 | function activate(context) { 307 | activateLuaDoc(context.extensionPath, context.subscriptions, { 308 | ViewType: context.ViewType || 'test-lua-doc', 309 | OpenCommand: context.OpenCommand || 'test.lua.doc', 310 | }); 311 | } 312 | 313 | exports.activate = activate; 314 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lua-doc", 3 | "displayName": "Lua Doc", 4 | "description": "", 5 | "version": "0.0.2", 6 | "publisher": "actboy168", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/actboy168/vscode-lua-doc" 10 | }, 11 | "bugs": { 12 | "url": "https://github.com/actboy168/vscode-lua-doc/issues" 13 | }, 14 | "categories": [ 15 | "Other" 16 | ], 17 | "engines": { 18 | "vscode": "^1.43.0" 19 | }, 20 | "activationEvents": [ 21 | "onWebviewPanel:test-lua-doc", 22 | "onCommand:test.lua.doc" 23 | ], 24 | "contributes": { 25 | "commands": [ 26 | { 27 | "command": "test.lua.doc", 28 | "title": "open webview", 29 | "category": "lua doc" 30 | } 31 | ] 32 | }, 33 | "main": "./extension.js" 34 | } --------------------------------------------------------------------------------