This file is indexed.

/usr/share/doc/monotone/html/Lua-Reference.html is in monotone-doc 1.0-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<html lang="en">
<head>
<title>Lua Reference - monotone documentation</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="monotone documentation">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Formats.html#Formats" title="Formats">
<link rel="next" href="Special-Topics.html#Special-Topics" title="Special Topics">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
<link rel="stylesheet" type="text/css" href="texinfo.css">
</head>
<body>
<div class="node">
<a name="Lua-Reference"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Special-Topics.html#Special-Topics">Special Topics</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Formats.html#Formats">Formats</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>

<h2 class="chapter">6 Lua Reference</h2>

<p>Monotone makes use of the <a href="http://www.lua.org">Lua</a> programming
language to customize and extend its behaviour.  By writing
<dfn>functions</dfn> which are loaded and evaluated at runtime, you can
help monotone to make a particular decision, set a suitable default or
preference or perform a certain action.

<p><a name="rcfiles"></a>Lua functions are defined in &ldquo;rcfiles&rdquo; which will be
read every time monotone runs. <samp><span class="file">rcfiles</span></samp> consist of:

     <ul>
<li><samp><span class="file">$HOME/.monotone/monotonerc</span></samp> on Unix or
<samp><span class="file">%APPDATA%\monotone\monotonerc</span></samp> on Windows

     <li><samp><span class="file">_MTN/monotonerc</span></samp> in the current workspace

     <li>Files given in the <samp><span class="option">--rcfile=</span><var>file</var></samp> option on the command line.

     <li>All files in a directory given by <samp><span class="option">--rcfile=</span><var>directory</var></samp> on
the command line. 
</ul>

<p>The files are loaded in the order <samp><span class="file">.monotone/monotonerc</span></samp>,
<samp><span class="file">_MTN/monotonerc</span></samp>, <samp><span class="option">--rcfile</span></samp> in the command line order. 
Definitions loaded later shadow (override) earlier definitions.

<p>There are two uses for Lua functions; hooks and user-defined
commands. This section documents hooks; see
<samp><span class="command"><a href="register_005fcommand.html#register_005fcommand">register_command</a></span></samp> for user-defined commands. The source
distribution contains some example user commands in the
<samp><span class="file">contrib/command</span></samp> directory.

<p>Hooks are Lua functions that are called from monotone code in many
places. Monotone provides default definitions for some hooks; see
<a href="Default-hooks.html#Default-hooks">Default hooks</a> for their complete source. For other hooks, if no
definition is provided, a default return value is used. When writing new
hooks, it may be helpful to reuse some code from the default
ones. Since Lua is a lexically scoped language with closures, this can
be achieved with the following code:

<pre class="smallexample">do
    local old_hook = default_hook
    function default_hook(arg)
        if not old_hook(arg) then
            -- do other stuff
        end
    end
end
</pre>
<p>Now the default hook is trapped in a variable local to this block, and can
only be seen by the new hook. Since in Lua functions default to the global
scope, the new hook is seen from inside monotone.

<p>Monotone also provides a number of helper functions to hook writers
exposing functionality not available with standard Lua.

<ul class="menu">
<li><a accesskey="1" href="Hooks.html#Hooks">Hooks</a>:                        All hooks called by monotone. 
<li><a accesskey="2" href="Additional-Lua-Functions.html#Additional-Lua-Functions">Additional Lua Functions</a>:     Extra functionality available to hook writers. 
<li><a accesskey="3" href="Implementation-Differences.html#Implementation-Differences">Implementation Differences</a>:   Functional differences from standard Lua
</ul>

</body></html>