examples of syntax highlighting in function @usage blocks; 'static' member functions
steve donovan
11 years ago
|
0 |
project = 'usage'
|
|
1 |
file = 'usage.lua'
|
|
2 |
format='markdown'
|
|
3 |
no_return_or_parms=true
|
|
4 |
no_summary=true
|
|
0 |
--[[--------
|
|
1 |
A simple module with examples.
|
|
2 |
|
|
3 |
@module usage
|
|
4 |
]]
|
|
5 |
|
|
6 |
local usage = {}
|
|
7 |
|
|
8 |
----------
|
|
9 |
-- A simple vector class
|
|
10 |
-- @type Vector
|
|
11 |
|
|
12 |
local Vector = {}
|
|
13 |
usage.Vector = {}
|
|
14 |
|
|
15 |
----------
|
|
16 |
-- Create a vector from an array `t`.
|
|
17 |
function Vector.new (t)
|
|
18 |
end
|
|
19 |
|
|
20 |
----------
|
|
21 |
-- Create a vector from a string.
|
|
22 |
-- @usage
|
|
23 |
-- v = Vector.parse '[1,2,3]'
|
|
24 |
-- assert (v == Vector.new {1,2,3})
|
|
25 |
function Vector.parse (s)
|
|
26 |
end
|
|
27 |
|
|
28 |
----------
|
|
29 |
-- Add another vector, array or scalar `v` to this vector.
|
|
30 |
-- Returns new `Vector`
|
|
31 |
-- @usage assert(Vector.new{1,2,3}:add(1) == Vector{2,3,4})
|
|
32 |
function Vector:add (v)
|
|
33 |
end
|
|
34 |
|
|
35 |
return usage
|
|
36 |
|
|
37 |
|