blob: d55fd076c21f64a5a3a9950062e0e61887aec3e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
-- Example plugin that demonstrates the objects available to a
-- plugin, as well as the methods that a plugin should make use
-- of
-- Adding methods and properties to the repl object adds them to
-- the REPL object loading the plugin. If such a method or property
-- already exists, the current plugin will fail to load.
function repl:newmethod(...)
end
-- Adding methods to the before object causes them to be called
-- before the actual method itself. If the method being added
-- (in this case displayresults) does not exist on the REPL object
-- loading this plugin, the current plugin will fail to load.
function before:displayresults(results)
end
-- Adding methods to the after object causes them to be called
-- after the actual method itself. If the method being added
-- (in this case displayresults) does not exist on the REPL object
-- loading this plugin, the current plugin will fail to load.
function after:displayresults(results)
end
-- Adding methods to the around object causes them to be called
-- instead of the original method of the same name. The new
-- method receives all of the arguments that the original would,
-- except it also receives the original method as the first argument.
-- This way, the new method may invoke the original as it pleases.
-- If the method being added (in this case displayresults) does not exist on
-- the REPL object loading this plugin, the current plugin will fail to load.
function around:evalute(orig, chunk)
end
-- Adding methods to the override object causes them to be called
-- instead of the original method of the same name. If the method being added
-- (in this case displayresults) does not exist on the REPL object loading this
-- plugin, the current plugin will fail to load.
function override:name()
return 'Plugin!'
end
|