Skip to content
Starlon edited this page Nov 30, 2011 · 1 revision

Functions

<tr>
<td class="name" nowrap><a href="#LibBuffer:AsList">LibBuffer:AsList</a>&nbsp;(list)</td>
<td class="summary">Return the buffer as a list </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:AsString">LibBuffer:AsString</a>&nbsp;()</td>
<td class="summary">Return the buffer as a concatenated string.</td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Clear">LibBuffer:Clear</a>&nbsp;()</td>
<td class="summary">Clear this buffer </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Clone">LibBuffer:Clone</a>&nbsp;(name)</td>
<td class="summary">Make a copy of this buffer </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Copy">LibBuffer:Copy</a>&nbsp;(other)</td>
<td class="summary">Copy this buffer into another </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Del">LibBuffer:Del</a>&nbsp;(buff)</td>
<td class="summary">Delete this buffer </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Fill">LibBuffer:Fill</a>&nbsp;(val)</td>
<td class="summary">Fill a buffer with a value </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:FromList">LibBuffer:FromList</a>&nbsp;(list)</td>
<td class="summary">Populate this buffer with the elements within the provided table </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:FromString">LibBuffer:FromString</a>&nbsp;(str)</td>
<td class="summary">Populate each cell in the buffer with characters from the provided string </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Insert">LibBuffer:Insert</a>&nbsp;(i, val)</td>
<td class="summary">Insert a new value in the buffer at the indicated index </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Line">LibBuffer:Line</a>&nbsp;(x0, y0, x1, y1, color, pitch)</td>
<td class="summary">The various line algorithms were found on the internet at various places.</td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Memcopy">LibBuffer:Memcopy</a>&nbsp;(pos1, buffer, pos2, length)</td>
<td class="summary">Copy another buffer into this one </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Memset">LibBuffer:Memset</a>&nbsp;(pos, val, length)</td>
<td class="summary">Set a subsection of this buffer to the specified value </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Merge">LibBuffer:Merge</a>&nbsp;(from, pos, len)</td>
<td class="summary">Merge one buffer into this one </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:MergeString">LibBuffer:MergeString</a>&nbsp;(pos1, str, pos2, length)</td>
<td class="summary">Merge a string into the buffer </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:MovingAverageExp">LibBuffer:MovingAverageExp</a>&nbsp;(alpha, epsilon, buf)</td>
<td class="summary">Retrieve the moving averages for this buffer of number values </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:New">LibBuffer:New</a>&nbsp;(name, size, defval, errorLevel)</td>
<td class="summary">Create a new LibScriptableBuffer object </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Randomize">LibBuffer:Randomize</a>&nbsp;()</td>
<td class="summary">Randomize the buffer </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Replace">LibBuffer:Replace</a>&nbsp;(pos, val)</td>
<td class="summary">Replace a buffer position with a new value.</td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Resize">LibBuffer:Resize</a>&nbsp;(size)</td>
<td class="summary">Resize a buffer </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Size">LibBuffer:Size</a>&nbsp;()</td>
<td class="summary">Return the size of this buffer </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Sub">LibBuffer:Sub</a>&nbsp;(num1, num2, buf, t)</td>
<td class="summary">Extract a subsection from this buffer </td>
</tr>

<tr>
<td class="name" nowrap><a href="#LibBuffer:Wipe">LibBuffer:Wipe</a>&nbsp;()</td>
<td class="summary">Wipe a buffer, </td>
</tr>


Functions

LibBuffer:AsList (list)
Return the buffer as a list

Parameters

<li>
  list: 
</li>

Usage:

:AsString()

Return value:

All cells in the buffer populating a list
LibBuffer:AsString ()
Return the buffer as a concatenated string.

Usage:

:AsString()

Return value:

All cells in the buffer concatenated as a string
LibBuffer:Clear ()
Clear this buffer

Usage:

:Clear()

Return value:

Nothing
LibBuffer:Clone (name)
Make a copy of this buffer

Parameters

<li>
  name: An optional name for the buffer, else this buffer's name is used
</li>

Usage:

Clone([name])

Return value:

A new LibBuffer populated with this buffer's data
LibBuffer:Copy (other)
Copy this buffer into another

Parameters

<li>
  other: The other LibBuffer object to copy into
</li>

Usage:

:Copy(other)

Return value:

Nothing
LibBuffer:Del (buff)
Delete this buffer

Parameters

<li>
  buff: 
</li>

Usage:

buffer:Del()
LibBuffer:Fill (val)
Fill a buffer with a value

Parameters

<li>
  val: The value to fill the buffer with
</li>

Usage:

:Fill(val)

Return value:

Nothing
LibBuffer:FromList (list)
Populate this buffer with the elements within the provided table

Parameters

<li>
  list: The table from which we'll copy into this buffer
</li>

Usage:

:FromList(list)

Return value:

Nothing
LibBuffer:FromString (str)
Populate each cell in the buffer with characters from the provided string

Parameters

<li>
  str: The string which to populate the buffer with
</li>

Usage:

:FromString(str)

Return value:

Nothing
LibBuffer:Insert (i, val)
Insert a new value in the buffer at the indicated index

Parameters

<li>
  i: The position in the buffer
</li>

<li>
  val: The value to insert
</li>

Usage:

:Insert(i, val)

Return value:

Nothing
LibBuffer:Line (x0, y0, x1, y1, color, pitch)
The various line algorithms were found on the internet at various places. Line(), Line2(), Line3(), Line4(), Line5() Some of these were found at the website of associate professor Leonard McMillan: http://www.cs.unc.edu/~mcmillan/comp136/Lecture6/Lines.html Some of these don't work. Line5() is the most efficient algorithm. The others should be regarded as deprecated as they will likely be removed.

Parameters

<li>
  x0: First X position
</li>

<li>
  y0: First Y position
</li>

<li>
  x1: Second X position
</li>

<li>
  y1: Second Y position
</li>

<li>
  color: The line will be filled with this value
</li>

<li>
  pitch: The buffer's width. [[
</li>
LibBuffer:Memcopy (pos1, buffer, pos2, length)
Copy another buffer into this one

Parameters

<li>
  pos1: The starting position in this buffer to copy
</li>

<li>
  buffer: The other buffer to copy
</li>

<li>
  pos2: The starting position in the other buffer where we'll begin copying
</li>

<li>
  length: The length of the subsection being copied
</li>

Usage:

:Memcopy(pos1, buffer, pos2, length)

Return value:

Nothing
LibBuffer:Memset (pos, val, length)
Set a subsection of this buffer to the specified value

Parameters

<li>
  pos: The starting position within this buffer to start assigning the specified value
</li>

<li>
  val: The value to assign to this buffer's subsection described by this method's other parameters
</li>

<li>
  length: The length of the subsection which is being assigned the specified value
</li>

Usage:

:Memset(pos, val, length)

Return value:

Nothing
LibBuffer:Merge (from, pos, len)
Merge one buffer into this one

Parameters

<li>
  from: The buffer from which we'll copy
</li>

<li>
  pos: The position in the other buffer that we'll start copying from
</li>

<li>
  len: The length of the content to merge
</li>

Usage:

:Merge(from, pos, len)

Return value:

Nothing
LibBuffer:MergeString (pos1, str, pos2, length)
Merge a string into the buffer

Parameters

<li>
  pos1: The index in this buffer to start merging from
</li>

<li>
  str: The string to merge
</li>

<li>
  pos2: The position in the string from which to start
</li>

<li>
  length: This is best expressed with a Lua expression :) str:sub(pos2, length)
</li>

Usage:

:MergeString(pos1, str, pos2, length)

Return value:

Nothing
LibBuffer:MovingAverageExp (alpha, epsilon, buf)
Retrieve the moving averages for this buffer of number values

Parameters

<li>
  alpha: 
</li>

<li>
  epsilon: 
</li>

<li>
  buf: 
</li>

Usage:

:MovingAverageExp(alpha, epsilon, buf)

Return value:

A new buffer populated with this buffer's moving averages
LibBuffer:New (name, size, defval, errorLevel)
Create a new LibScriptableBuffer object

Parameters

<li>
  name: A name for the buffer
</li>

<li>
  size: The buffer's size
</li>

<li>
  defval: The buffer's default value. The alpha channel.
</li>

<li>
  errorLevel: The verbocity level
</li>

Usage:

LibBuffer:New(name, size, defval, errorLevel)

Return value:

A new LibScriptableBuffer object
LibBuffer:Randomize ()
Randomize the buffer

Usage:

:Randomize()
LibBuffer:Replace (pos, val)
Replace a buffer position with a new value.

Parameters

<li>
  pos: The position in the buffer to replace
</li>

<li>
  val: The new value
</li>

Usage:

:Replace(pos, val)

Return value:

Nothing
LibBuffer:Resize (size)
Resize a buffer

Parameters

<li>
  size: The buffer's new size
</li>

Usage:

:Resize(size)

Return value:

Nothing
LibBuffer:Size ()
Return the size of this buffer

Usage:

:Size()

Return value:

The size of this buffer
LibBuffer:Sub (num1, num2, buf, t)
Extract a subsection from this buffer

Parameters

<li>
  num1: The starting position in the buffer from which to copy
</li>

<li>
  num2: THe ending position in the buffer from which to copy
</li>

<li>
  buf: 
</li>

<li>
  t: An optional LibBuffer object
</li>

Usage:

:Sub(num1, num2)

Return value:

A new LibBuffer populated with this table subsection between num1 and num2
LibBuffer:Wipe ()
Wipe a buffer,

Usage:

:Wipe()

Return value:

Nothing

Clone this wiki locally