File: curses.chstr.html

package info (click to toggle)
lua-curses 1%3A9.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,328 kB
  • sloc: sh: 11,898; ansic: 2,704; makefile: 52
file content (336 lines) | stat: -rw-r--r-- 9,015 bytes parent folder | download | duplicates (2)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
    <title>lcurses 9.0.0 Reference</title>
    <link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>

<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->


<div id="main">


<!-- Menu -->

<div id="navigation">
<br/>
<h1>lcurses 9.0.0</h1>

<ul>
  <li><a href="../index.html">Index</a></li>
</ul>

<h2>Contents</h2>
<ul>
<li><a href="#Methods">Methods</a></li>
<li><a href="#Metamethods">Metamethods</a></li>
</ul>


<h2>Classes</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
  <li><strong>curses.chstr</strong></li>
  <li><a href="../classes/curses.window.html">curses.window</a></li>
</ul>
<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
  <li><a href="../modules/curses.html">curses</a></li>
</ul>
<h2>Examples</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
  <li><a href="../examples/curses.lua.html">curses.lua</a></li>
</ul>

</div>

<div id="content">

<h1>Class <code>curses.chstr</code></h1>
<p>Curses attributed string buffers.</p>
<p>An array of characters, plus associated curses attributes and
colors at each position.</p>

<p>Although marginally useful alone, the constants used to set colors
and attributes in <code>chstr</code> buffers are not defined until <strong>after</strong>
<code>curses.initscr ()</code> has been called.</p>


<h2><a href="#Methods">Methods</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#curses.chstr:dup">curses.chstr:dup ()</a></td>
	<td class="summary">Duplicate chstr.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#curses.chstr:get">curses.chstr:get (o)</a></td>
	<td class="summary">Get information from the chstr.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#curses.chstr:len">curses.chstr:len (cs)</a></td>
	<td class="summary">Retrieve chstr length.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#curses.chstr:set_ch">curses.chstr:set_ch (o, int[, attr=A_NORMAL[, rep=1]])</a></td>
	<td class="summary">Set a character in the buffer.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#curses.chstr:set_str">curses.chstr:set_str (o, s[, attr=A_NORMAL[, rep=1]])</a></td>
	<td class="summary">Change the contents of the chstr.</td>
	</tr>
</table>
<h2><a href="#Metamethods">Metamethods</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#curses.chstr:__call">curses.chstr:__call (len)</a></td>
	<td class="summary">Initialise a new chstr.</td>
	</tr>
</table>

<br/>
<br/>


    <h2 class="section-header "><a name="Methods"></a>Methods</h2>

    <dl class="function">
    <dt>
    <a name = "curses.chstr:dup"></a>
    <strong>curses.chstr:dup ()</strong>
    </dt>
    <dd>
    Duplicate chstr.



    <h3>Returns:</h3>
    <ol>

           <span class="types"><a class="type" href="../classes/curses.chstr.html">chstr</a></span>
        duplicate of <em>cs</em>
    </ol>



    <h3>Usage:</h3>
    <ul>
        <pre class="example">dup = cs:dup ()</pre>
    </ul>

</dd>
    <dt>
    <a name = "curses.chstr:get"></a>
    <strong>curses.chstr:get (o)</strong>
    </dt>
    <dd>
    Get information from the chstr.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">o</span>
            <span class="types"><span class="type">int</span></span>
         offset from start of <em>cs</em>
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>
        <li>
           <span class="types"><span class="type">int</span></span>
        character at offset <em>o</em> in <em>cs</em></li>
        <li>
           <span class="types"><span class="type">int</span></span>
        bitwise-OR of attributes at offset <em>o</em> in <em>cs</em></li>
        <li>
           <span class="types"><span class="type">int</span></span>
        colorpair at offset <em>o</em> in <em>cs</em></li>
    </ol>



    <h3>Usage:</h3>
    <ul>
        <pre class="example">
  cs = curses.chstr (<span class="number">10</span>)
  cs:set_ch(<span class="number">0</span>, <span class="string">'A'</span>, curses.A_BOLD, <span class="number">10</span>)
  <span class="comment">--&gt; 65 2097152 0
</span>  <span class="global">print</span> (cs:get (<span class="number">9</span>))</pre>
    </ul>

</dd>
    <dt>
    <a name = "curses.chstr:len"></a>
    <strong>curses.chstr:len (cs)</strong>
    </dt>
    <dd>
    Retrieve chstr length.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">cs</span>
            <span class="types"><a class="type" href="../classes/curses.chstr.html">chstr</a></span>
         buffer to act on
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><span class="type">int</span></span>
        length of <em>cs</em>
    </ol>



    <h3>Usage:</h3>
    <ul>
        <pre class="example">
  cs = curses.chstr (<span class="number">123</span>)
  <span class="comment">--&gt; 123
</span>  <span class="global">print</span> (cs:len ())</pre>
    </ul>

</dd>
    <dt>
    <a name = "curses.chstr:set_ch"></a>
    <strong>curses.chstr:set_ch (o, int[, attr=A_NORMAL[, rep=1]])</strong>
    </dt>
    <dd>
    Set a character in the buffer.
ch* can be a one-character string, or an integer from <code>string.byte</code>


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">o</span>
            <span class="types"><span class="type">int</span></span>
         offset to start of change
        </li>
        <li><span class="parameter">int</span>
        |string ch character to insert
        </li>
        <li><span class="parameter">attr</span>
            <span class="types"><span class="type">int</span></span>
         attributes for changed elements
         (<em>default</em> A_NORMAL)
        </li>
        <li><span class="parameter">rep</span>
            <span class="types"><span class="type">int</span></span>
         repeat count
         (<em>default</em> 1)
        </li>
    </ul>




    <h3>Usage:</h3>
    <ul>
        <pre class="example">
  <span class="comment">-- Write a bold 'A' followed by normal 'a' chars to a new buffer
</span>  size = <span class="number">10</span>
  cs = curses.chstr (size)
  cs:set_ch(<span class="number">0</span>, <span class="string">'A'</span>, curses.A_BOLD)
  cs:set_ch(<span class="number">1</span>, <span class="string">'a'</span>, curses.A_NORMAL, size - <span class="number">1</span>)</pre>
    </ul>

</dd>
    <dt>
    <a name = "curses.chstr:set_str"></a>
    <strong>curses.chstr:set_str (o, s[, attr=A_NORMAL[, rep=1]])</strong>
    </dt>
    <dd>
    Change the contents of the chstr.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">o</span>
            <span class="types"><span class="type">int</span></span>
         offset to start of change
        </li>
        <li><span class="parameter">s</span>
            <span class="types"><a class="type" href="http://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
         characters to insert into <em>cs</em> at <em>o</em>
        </li>
        <li><span class="parameter">attr</span>
            <span class="types"><span class="type">int</span></span>
         attributes for changed elements
         (<em>default</em> A_NORMAL)
        </li>
        <li><span class="parameter">rep</span>
            <span class="types"><span class="type">int</span></span>
         repeat count
         (<em>default</em> 1)
        </li>
    </ul>




    <h3>Usage:</h3>
    <ul>
        <pre class="example">
  cs = curses.chstr (<span class="number">10</span>)
  cs:set_str(<span class="number">0</span>, <span class="string">"0123456789"</span>, curses.A_BOLD)</pre>
    </ul>

</dd>
</dl>
    <h2 class="section-header "><a name="Metamethods"></a>Metamethods</h2>

    <dl class="function">
    <dt>
    <a name = "curses.chstr:__call"></a>
    <strong>curses.chstr:__call (len)</strong>
    </dt>
    <dd>
    Initialise a new chstr.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">len</span>
            <span class="types"><span class="type">int</span></span>
         buffer length
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><a class="type" href="../classes/curses.chstr.html">chstr</a></span>
        a new chstr filled with spaces
    </ol>



    <h3>Usage:</h3>
    <ul>
        <pre class="example">cs = curses.chstr (<span class="number">10</span>)</pre>
    </ul>

</dd>
</dl>


</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
<i style="float:right;">Last updated 2016-01-10 18:31:15 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>