(LibSata) Safe's Table Library

Last Updated: Jan 20, 2017 Game Version: 2.3

65,048

Apr 16, 2013

Owner: Kekoas

About

This library provides several functions and methods for managing linked lists. These are non-indexed tables best used for first in-first out or last in-first out scenarios such as Stacks or Caching systems.

It is flexible enough to be used for fast sort insertion since you can index table positions such as ("A", "B"..."Z") etc, and push new entries directly in these sub points. However, without direct access to file i/o within Rift, massive database handling is probably not advised.

Documentation

Returned Variables

  • Table: A LibSata Table.
  • Object: A Table Object.
  • Data: The data contained within that Object. Data can be any data type, including user types.

LibSata Commands

  • Table = LibSata:Create()
    • Creates a base table.
  • for Object, Data in LibSata.EachIn(Table) do end
    • LibSata.EachIn can be used to traverse through a Table using the {for do end} Lua method.
    • Note: use local each = LibSata.EachIn if you wish to use a more natural method.

Table Methods

Table Object Creation

  • Object = Table:Add(Data)
    • Creates a new Table Object and places it at the end of the Table.
  • Object = Table:InsertFirst(Data)
    • Creates a new Table Object and inserts it at the start of the Table.
  • Object = Table:InsertBefore(Object, Data)
    • Creates a new Table Object and inserts it before the supplied Table Object.
  • Object = Table:InsertAfter(Object, Data)
    • Creates a new Table Object and inserts it after the supplied Table Object.

Table Object Retrieval.

  • Object, Data = Table:First()
    • Retrieves the first Table object in a Table.
  • Object, Data = Table:Last()
    • Retrieves the last Table object in a Table.
  • Object, Data = Table:After(Object)
    • Returns the next Object in a Table after the supplied Object or nil if the Object is the last in the Table.
  • Object, Data = Table:Before(Object)
    • Returns the previous Object in a Table before the supplied Object or nil if the Object is the first in the Table.

Table Management

  • Data = Table:Remove(Object)
    • Returns the data for the supplied Object then removes it from the Table.
  • Data = Table:RemoveFirst()
    • Returns the data from the first Object in a table and removes the Object.
  • Data = Table:RemoveLast()
    • Returns the data from the last Object in a table and removes the Object.
  • Number = Table:Count()
    • Returns the number of Table Objects within the Table.
  • nil = Table:Clear()
    • Clears all Objects in a table but does not delete the table.
  • nil = Table:Delete()
    • Removes a Table from memory, clearing all Table Objects and the Table itself. Any external references to Table Objects or the Table will also need to be set to nil. Returns nil.

Comments

Posts Quoted:
Reply
Clear All Quotes