check builtin references. Builtin files are now all requireable (without module)
This commit is contained in:
parent
a162c4b9e9
commit
5e18d2ad4c
|
@ -1,6 +1,7 @@
|
||||||
--- creating and controlling coroutines.
|
--- creating and controlling coroutines.
|
||||||
|
-- @module coroutine
|
||||||
|
|
||||||
module 'coroutine'
|
local coroutine = {}
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Creates a new coroutine, with body `f`. `f` must be a Lua
|
-- Creates a new coroutine, with body `f`. `f` must be a Lua
|
||||||
|
@ -46,3 +47,4 @@ function coroutine.wrap(f) end
|
||||||
-- `yield` are passed as extra results to `resume`.
|
-- `yield` are passed as extra results to `resume`.
|
||||||
function coroutine.yield(...) end
|
function coroutine.yield(...) end
|
||||||
|
|
||||||
|
return coroutine
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
--- getting runtime debug information.
|
--- getting runtime debug information.
|
||||||
|
-- @module debug
|
||||||
|
|
||||||
module 'debug'
|
local debug = {}
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Enters an interactive mode with the user, running each string that
|
-- Enters an interactive mode with the user, running each string that
|
||||||
-- the user enters. Using simple commands and other debug facilities,
|
-- the user enters. Using simple commands and other debug facilities,
|
||||||
|
@ -121,3 +121,4 @@ function debug.setmetatable(object, table) end
|
||||||
-- with the given index. Otherwise, it returns the name of the upvalue.
|
-- with the given index. Otherwise, it returns the name of the upvalue.
|
||||||
function debug.setupvalue(func, up, value) end
|
function debug.setupvalue(func, up, value) end
|
||||||
|
|
||||||
|
return debug
|
||||||
|
|
|
@ -91,9 +91,17 @@ local function function_ref (name,tbl)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if tables[tbl] then -- function inside standard Lua table
|
if tables[tbl] then -- function inside standard Lua table
|
||||||
|
local t = rawget(_G,tbl) -- do a quick sanity check
|
||||||
|
if not rawget(t,name) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
name = tbl..'.'..name
|
name = tbl..'.'..name
|
||||||
href = fun_ref..name
|
href = fun_ref..name
|
||||||
elseif xlibs[tbl] then -- in external libs, use LDoc style
|
elseif xlibs[tbl] then -- in external libs, use LDoc style
|
||||||
|
local t = require('ldoc.builtin.'..tbl)
|
||||||
|
if not rawget(t,name) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
href = xlib_url..xlibs[tbl]..'#'..name
|
href = xlib_url..xlibs[tbl]..'#'..name
|
||||||
name = tbl..'.'..name
|
name = tbl..'.'..name
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
--- Reading and Writing Files.
|
--- Reading and Writing Files.
|
||||||
|
-- @module io
|
||||||
|
|
||||||
module 'io'
|
local io = {}
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Equivalent to `file:close()`. Without a `file`, closes the default
|
-- Equivalent to `file:close()`. Without a `file`, closes the default
|
||||||
|
@ -155,3 +156,4 @@ function file:setvbuf(mode , size) end
|
||||||
-- `string.format` before `write`.
|
-- `string.format` before `write`.
|
||||||
function file:write(...) end
|
function file:write(...) end
|
||||||
|
|
||||||
|
return io
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
--- File and Directory manipulation
|
--- File and Directory manipulation
|
||||||
|
-- @module lfs
|
||||||
|
|
||||||
module 'lfs'
|
local lfs = {}
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Returns a table with the file attributes corresponding to filepath (or nil
|
-- Returns a table with the file attributes corresponding to filepath (or nil
|
||||||
|
@ -73,7 +74,7 @@ function lfs.dir(path) end
|
||||||
-- and its length; both should be numbers.
|
-- and its length; both should be numbers.
|
||||||
-- Returns true if the operation was successful; in case of error, it returns
|
-- Returns true if the operation was successful; in case of error, it returns
|
||||||
-- nil plus an error string.
|
-- nil plus an error string.
|
||||||
function lfs.lock(filehandle, mode, start, length)
|
function lfs.lock(filehandle, mode, start, length) end
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Creates a new directory. The argument is the name of the new directory.
|
-- Creates a new directory. The argument is the name of the new directory.
|
||||||
|
@ -120,3 +121,5 @@ function lfs.touch(filepath , atime , mtime) end
|
||||||
-- Returns true if the operation was successful; in case of error, it returns
|
-- Returns true if the operation was successful; in case of error, it returns
|
||||||
-- nil plus an error string.
|
-- nil plus an error string.
|
||||||
function lfs.unlock(filehandle, start, length) end
|
function lfs.unlock(filehandle, start, length) end
|
||||||
|
|
||||||
|
return lfs
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
--- LPeg PEG pattern matching.
|
--- LPeg PEG pattern matching.
|
||||||
|
-- @module lpeg
|
||||||
|
|
||||||
module 'lpeg'
|
local lpeg = {}
|
||||||
|
|
||||||
---
|
---
|
||||||
-- The matching function. It attempts to match the given pattern against the
|
-- The matching function. It attempts to match the given pattern against the
|
||||||
|
@ -209,3 +210,5 @@ function lpeg.Ct(patt) end
|
||||||
-- Any extra values returned by the function become the values produced by the
|
-- Any extra values returned by the function become the values produced by the
|
||||||
-- capture.
|
-- capture.
|
||||||
function lpeg.Cmt(patt, function) end
|
function lpeg.Cmt(patt, function) end
|
||||||
|
|
||||||
|
return lpeg
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
--- standard mathematical functions.
|
--- standard mathematical functions.
|
||||||
|
-- @module math
|
||||||
|
|
||||||
module 'math'
|
local math = {}
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Returns the absolute value of `x`.
|
-- Returns the absolute value of `x`.
|
||||||
|
@ -140,3 +141,4 @@ function math.tan(x) end
|
||||||
-- Returns the hyperbolic tangent of `x`.
|
-- Returns the hyperbolic tangent of `x`.
|
||||||
function math.tanh(x) end
|
function math.tanh(x) end
|
||||||
|
|
||||||
|
return math
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
--- Operating System facilities like date, time and program execution.
|
--- Operating System facilities like date, time and program execution.
|
||||||
|
-- @module os
|
||||||
|
|
||||||
module 'os'
|
local os = {}
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Returns an approximation of the amount in seconds of CPU time used by
|
-- Returns an approximation of the amount in seconds of CPU time used by
|
||||||
|
@ -108,3 +109,4 @@ function os.time(table) end
|
||||||
-- removes the file when the program ends.
|
-- removes the file when the program ends.
|
||||||
function os.tmpname() end
|
function os.tmpname() end
|
||||||
|
|
||||||
|
return os
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
--- controlling how `require` finds packages.
|
--- controlling how `require` finds packages.
|
||||||
|
-- @module package
|
||||||
|
|
||||||
module 'package'
|
local package = {}
|
||||||
|
|
||||||
---
|
---
|
||||||
-- The path used by `require` to search for a C loader.
|
-- The path used by `require` to search for a C loader.
|
||||||
|
@ -93,3 +94,4 @@ function package.loadlib(libname, funcname) end
|
||||||
-- environment. To be used as an option to function `module`.
|
-- environment. To be used as an option to function `module`.
|
||||||
function package.seeall(module) end
|
function package.seeall(module) end
|
||||||
|
|
||||||
|
return package
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
--- string operations like searching and matching.
|
--- string operations like searching and matching.
|
||||||
|
-- @module string
|
||||||
|
|
||||||
module 'string'
|
local string = {}
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Returns the internal numerical codes of the characters `s[i]`, `s[i+1]`,
|
-- Returns the internal numerical codes of the characters `s[i]`, `s[i+1]`,
|
||||||
|
@ -170,3 +171,5 @@ function string.sub(s, i , j) end
|
||||||
-- definition of what a lowercase letter is depends on the current locale.
|
-- definition of what a lowercase letter is depends on the current locale.
|
||||||
function string.upper(s) end
|
function string.upper(s) end
|
||||||
|
|
||||||
|
return string
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
--- manipulating Lua tables.
|
--- manipulating Lua tables.
|
||||||
|
-- @module table
|
||||||
|
|
||||||
module 'table'
|
local table = {}
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Given an array where all elements are strings or numbers, returns
|
-- Given an array where all elements are strings or numbers, returns
|
||||||
|
@ -39,3 +40,5 @@ function table.remove(table , pos) end
|
||||||
-- (so that `not comp(a[i+1],a[i])` will be true after the sort). If `comp`
|
-- (so that `not comp(a[i+1],a[i])` will be true after the sort). If `comp`
|
||||||
-- is not given, then the '<' operator will be used.
|
-- is not given, then the '<' operator will be used.
|
||||||
function table.sort(table , comp) end
|
function table.sort(table , comp) end
|
||||||
|
|
||||||
|
return table
|
||||||
|
|
Loading…
Reference in New Issue