diff --git a/ldoc/builtin/coroutine.lua b/ldoc/builtin/coroutine.lua index 6992e20..b6ea463 100644 --- a/ldoc/builtin/coroutine.lua +++ b/ldoc/builtin/coroutine.lua @@ -1,6 +1,7 @@ --- creating and controlling coroutines. +-- @module coroutine -module 'coroutine' +local coroutine = {} --- -- 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`. function coroutine.yield(...) end +return coroutine diff --git a/ldoc/builtin/debug.lua b/ldoc/builtin/debug.lua index a5dd0be..981a638 100644 --- a/ldoc/builtin/debug.lua +++ b/ldoc/builtin/debug.lua @@ -1,7 +1,7 @@ --- getting runtime debug information. +-- @module debug -module 'debug' - +local debug = {} --- -- Enters an interactive mode with the user, running each string that -- 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. function debug.setupvalue(func, up, value) end +return debug diff --git a/ldoc/builtin/globals.lua b/ldoc/builtin/globals.lua index deb0c45..df6a903 100644 --- a/ldoc/builtin/globals.lua +++ b/ldoc/builtin/globals.lua @@ -91,9 +91,17 @@ local function function_ref (name,tbl) end end 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 href = fun_ref..name 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 name = tbl..'.'..name else diff --git a/ldoc/builtin/io.lua b/ldoc/builtin/io.lua index f8145a1..28253df 100644 --- a/ldoc/builtin/io.lua +++ b/ldoc/builtin/io.lua @@ -1,6 +1,7 @@ --- Reading and Writing Files. +-- @module io -module 'io' +local io = {} --- -- Equivalent to `file:close()`. Without a `file`, closes the default @@ -155,3 +156,4 @@ function file:setvbuf(mode , size) end -- `string.format` before `write`. function file:write(...) end +return io diff --git a/ldoc/builtin/lfs.lua b/ldoc/builtin/lfs.lua index 772fbb0..ed37bc1 100644 --- a/ldoc/builtin/lfs.lua +++ b/ldoc/builtin/lfs.lua @@ -1,6 +1,7 @@ --- File and Directory manipulation +-- @module lfs -module 'lfs' +local lfs = {} --- -- 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. -- Returns true if the operation was successful; in case of error, it returns -- 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. @@ -120,3 +121,5 @@ function lfs.touch(filepath , atime , mtime) end -- Returns true if the operation was successful; in case of error, it returns -- nil plus an error string. function lfs.unlock(filehandle, start, length) end + +return lfs diff --git a/ldoc/builtin/lpeg.lua b/ldoc/builtin/lpeg.lua index 97053a7..b2c020e 100644 --- a/ldoc/builtin/lpeg.lua +++ b/ldoc/builtin/lpeg.lua @@ -1,6 +1,7 @@ --- LPeg PEG pattern matching. +-- @module lpeg -module 'lpeg' +local lpeg = {} --- -- 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 -- capture. function lpeg.Cmt(patt, function) end + +return lpeg diff --git a/ldoc/builtin/math.lua b/ldoc/builtin/math.lua index d3e9e79..9e97544 100644 --- a/ldoc/builtin/math.lua +++ b/ldoc/builtin/math.lua @@ -1,6 +1,7 @@ --- standard mathematical functions. +-- @module math -module 'math' +local math = {} --- -- Returns the absolute value of `x`. @@ -140,3 +141,4 @@ function math.tan(x) end -- Returns the hyperbolic tangent of `x`. function math.tanh(x) end +return math diff --git a/ldoc/builtin/os.lua b/ldoc/builtin/os.lua index 87a4a3f..a8b3665 100644 --- a/ldoc/builtin/os.lua +++ b/ldoc/builtin/os.lua @@ -1,6 +1,7 @@ --- 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 @@ -108,3 +109,4 @@ function os.time(table) end -- removes the file when the program ends. function os.tmpname() end +return os diff --git a/ldoc/builtin/package.lua b/ldoc/builtin/package.lua index 45e9b5d..61a60c5 100644 --- a/ldoc/builtin/package.lua +++ b/ldoc/builtin/package.lua @@ -1,6 +1,7 @@ --- controlling how `require` finds packages. +-- @module package -module 'package' +local package = {} --- -- 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`. function package.seeall(module) end +return package diff --git a/ldoc/builtin/string.lua b/ldoc/builtin/string.lua index e69ccb1..af7448f 100644 --- a/ldoc/builtin/string.lua +++ b/ldoc/builtin/string.lua @@ -1,6 +1,7 @@ --- 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]`, @@ -170,3 +171,5 @@ function string.sub(s, i , j) end -- definition of what a lowercase letter is depends on the current locale. function string.upper(s) end +return string + diff --git a/ldoc/builtin/table.lua b/ldoc/builtin/table.lua index a386a30..7221535 100644 --- a/ldoc/builtin/table.lua +++ b/ldoc/builtin/table.lua @@ -1,6 +1,7 @@ --- manipulating Lua tables. +-- @module table -module 'table' +local table = {} --- -- 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` -- is not given, then the '<' operator will be used. function table.sort(table , comp) end + +return table