check builtin references. Builtin files are now all requireable (without module)

This commit is contained in:
Steve Donovan 2013-08-22 09:15:16 +02:00
parent a162c4b9e9
commit 5e18d2ad4c
11 changed files with 43 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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