Blob Blame History Raw
<!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>luaposix 33.3.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>luaposix 33.3.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>posix.curses.chstr</strong></li>
  <li><a href="../classes/posix.curses.window.html">posix.curses.window</a></li>
</ul>
<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
  <li><a href="../modules/posix.html">posix</a></li>
  <li><a href="../modules/posix.ctype.html">posix.ctype</a></li>
  <li><a href="../modules/posix.curses.html">posix.curses</a></li>
  <li><a href="../modules/posix.dirent.html">posix.dirent</a></li>
  <li><a href="../modules/posix.errno.html">posix.errno</a></li>
  <li><a href="../modules/posix.fcntl.html">posix.fcntl</a></li>
  <li><a href="../modules/posix.fnmatch.html">posix.fnmatch</a></li>
  <li><a href="../modules/posix.getopt.html">posix.getopt</a></li>
  <li><a href="../modules/posix.glob.html">posix.glob</a></li>
  <li><a href="../modules/posix.grp.html">posix.grp</a></li>
  <li><a href="../modules/posix.libgen.html">posix.libgen</a></li>
  <li><a href="../modules/posix.poll.html">posix.poll</a></li>
  <li><a href="../modules/posix.pwd.html">posix.pwd</a></li>
  <li><a href="../modules/posix.sched.html">posix.sched</a></li>
  <li><a href="../modules/posix.signal.html">posix.signal</a></li>
  <li><a href="../modules/posix.stdio.html">posix.stdio</a></li>
  <li><a href="../modules/posix.stdlib.html">posix.stdlib</a></li>
  <li><a href="../modules/posix.sys.msg.html">posix.sys.msg</a></li>
  <li><a href="../modules/posix.sys.resource.html">posix.sys.resource</a></li>
  <li><a href="../modules/posix.sys.socket.html">posix.sys.socket</a></li>
  <li><a href="../modules/posix.sys.stat.html">posix.sys.stat</a></li>
  <li><a href="../modules/posix.sys.statvfs.html">posix.sys.statvfs</a></li>
  <li><a href="../modules/posix.sys.time.html">posix.sys.time</a></li>
  <li><a href="../modules/posix.sys.times.html">posix.sys.times</a></li>
  <li><a href="../modules/posix.sys.utsname.html">posix.sys.utsname</a></li>
  <li><a href="../modules/posix.sys.wait.html">posix.sys.wait</a></li>
  <li><a href="../modules/posix.syslog.html">posix.syslog</a></li>
  <li><a href="../modules/posix.termio.html">posix.termio</a></li>
  <li><a href="../modules/posix.time.html">posix.time</a></li>
  <li><a href="../modules/posix.unistd.html">posix.unistd</a></li>
  <li><a href="../modules/posix.utime.html">posix.utime</a></li>
</ul>
<h2>Examples</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
  <li><a href="../examples/curses.lua.html">curses.lua</a></li>
  <li><a href="../examples/dir.lua.html">dir.lua</a></li>
  <li><a href="../examples/fork.lua.html">fork.lua</a></li>
  <li><a href="../examples/fork2.lua.html">fork2.lua</a></li>
  <li><a href="../examples/getopt.lua.html">getopt.lua</a></li>
  <li><a href="../examples/glob.lua.html">glob.lua</a></li>
  <li><a href="../examples/limit.lua.html">limit.lua</a></li>
  <li><a href="../examples/lock.lua.html">lock.lua</a></li>
  <li><a href="../examples/netlink-uevent.lua.html">netlink-uevent.lua</a></li>
  <li><a href="../examples/ping.lua.html">ping.lua</a></li>
  <li><a href="../examples/poll.lua.html">poll.lua</a></li>
  <li><a href="../examples/rt_sched.lua.html">rt_sched.lua</a></li>
  <li><a href="../examples/signal.lua.html">signal.lua</a></li>
  <li><a href="../examples/socket.lua.html">socket.lua</a></li>
  <li><a href="../examples/termios.lua.html">termios.lua</a></li>
  <li><a href="../examples/tree.lua.html">tree.lua</a></li>
</ul>

</div>

<div id="content">

<h1>Class <code>posix.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="#posix.curses.chstr:dup">posix.curses.chstr:dup ()</a></td>
	<td class="summary">Duplicate chstr.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#posix.curses.chstr:get">posix.curses.chstr:get (o)</a></td>
	<td class="summary">Get information from the chstr.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#posix.curses.chstr:len">posix.curses.chstr:len (cs)</a></td>
	<td class="summary">Retrieve chstr length.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#posix.curses.chstr:set_ch">posix.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="#posix.curses.chstr:set_str">posix.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="#posix.curses.chstr:__call">posix.curses.chstr:__call (len)</a></td>
	<td class="summary">Initialise a new chstr.</td>
	</tr>
</table>

<br/>
<br/>


    <h2><a name="Methods"></a>Methods</h2>

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



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

           <span class="types"><a class="type" href="../classes/posix.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 = "posix.curses.chstr:get"></a>
    <strong>posix.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 = "posix.curses.chstr:len"></a>
    <strong>posix.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/posix.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 = "posix.curses.chstr:set_ch"></a>
    <strong>posix.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 = "posix.curses.chstr:set_str"></a>
    <strong>posix.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.1/manual.html#5.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><a name="Metamethods"></a>Metamethods</h2>

    <dl class="function">
    <dt>
    <a name = "posix.curses.chstr:__call"></a>
    <strong>posix.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/posix.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 2015-03-01 09:06:02 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>