File ../../LibScriptableUtils-1.0/LibScriptableUtilsBuffer-1.0/LibScriptableUtilsBuffer-1.0.lua

Functions

LibBuffer:AsList (list) Return the buffer as a list
LibBuffer:AsString () Return the buffer as a concatenated string.
LibBuffer:Clear () Clear this buffer
LibBuffer:Clone (name) Make a copy of this buffer
LibBuffer:Copy (other) Copy this buffer into another
LibBuffer:Del (buff) Delete this buffer
LibBuffer:Fill (val) Fill a buffer with a value
LibBuffer:FromList (list) Populate this buffer with the elements within the provided table
LibBuffer:FromString (str) Populate each cell in the buffer with characters from the provided string
LibBuffer:Insert (i, val) Insert a new value in the buffer at the indicated index
LibBuffer:Line (x0, y0, x1, y1, color, pitch) The various line algorithms were found on the internet at various places.
LibBuffer:Memcopy (pos1, buffer, pos2, length) Copy another buffer into this one
LibBuffer:Memset (pos, val, length) Set a subsection of this buffer to the specified value
LibBuffer:Merge (from, pos, len) Merge one buffer into this one
LibBuffer:MergeString (pos1, str, pos2, length) Merge a string into the buffer
LibBuffer:MovingAverageExp (alpha, epsilon, buf) Retrieve the moving averages for this buffer of number values
LibBuffer:New (name, size, defval, errorLevel) Create a new LibScriptableBuffer object
LibBuffer:Randomize () Randomize the buffer
LibBuffer:Replace (pos, val) Replace a buffer position with a new value.
LibBuffer:Resize (size) Resize a buffer
LibBuffer:Size () Return the size of this buffer
LibBuffer:Sub (num1, num2, buf, t) Extract a subsection from this buffer
LibBuffer:Wipe () Wipe a buffer,


Functions

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

Parameters

  • list:

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

  • name: An optional name for the buffer, else this buffer's name is used

Usage:

Clone([name])

Return value:

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

Parameters

  • other: The other LibBuffer object to copy into

Usage:

:Copy(other)

Return value:

Nothing
LibBuffer:Del (buff)
Delete this buffer

Parameters

  • buff:

Usage:

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

Parameters

  • val: The value to fill the buffer with

Usage:

:Fill(val)

Return value:

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

Parameters

  • list: The table from which we'll copy into this buffer

Usage:

:FromList(list)

Return value:

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

Parameters

  • str: The string which to populate the buffer with

Usage:

:FromString(str)

Return value:

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

Parameters

  • i: The position in the buffer
  • val: The value to insert

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

  • x0: First X position
  • y0: First Y position
  • x1: Second X position
  • y1: Second Y position
  • color: The line will be filled with this value
  • pitch: The buffer's width. [[
LibBuffer:Memcopy (pos1, buffer, pos2, length)
Copy another buffer into this one

Parameters

  • pos1: The starting position in this buffer to copy
  • buffer: The other buffer to copy
  • pos2: The starting position in the other buffer where we'll begin copying
  • length: The length of the subsection being copied

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

  • pos: The starting position within this buffer to start assigning the specified value
  • val: The value to assign to this buffer's subsection described by this method's other parameters
  • length: The length of the subsection which is being assigned the specified value

Usage:

:Memset(pos, val, length)

Return value:

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

Parameters

  • from: The buffer from which we'll copy
  • pos: The position in the other buffer that we'll start copying from
  • len: The length of the content to merge

Usage:

:Merge(from, pos, len)

Return value:

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

Parameters

  • pos1: The index in this buffer to start merging from
  • str: The string to merge
  • pos2: The position in the string from which to start
  • length: This is best expressed with a Lua expression :) str:sub(pos2, length)

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

  • alpha:
  • epsilon:
  • buf:

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

  • name: A name for the buffer
  • size: The buffer's size
  • defval: The buffer's default value. The alpha channel.
  • errorLevel: The verbocity level

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

  • pos: The position in the buffer to replace
  • val: The new value

Usage:

:Replace(pos, val)

Return value:

Nothing
LibBuffer:Resize (size)
Resize a buffer

Parameters

  • size: The buffer's new size

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

  • num1: The starting position in the buffer from which to copy
  • num2: THe ending position in the buffer from which to copy
  • buf:
  • t: An optional LibBuffer object

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

Valid XHTML 1.0!