Difference between revisions of "Luo"

From OpenEUO
Jump to: navigation, search
m (Description)
m (See Also)
 
(6 intermediate revisions by the same user not shown)
Line 20: Line 20:
 
== Description ==
 
== Description ==
  
luo stands for 'live uo' table, it provides [http://en.wikipedia.org/wiki/Functor functors] that, when called, access the underlying values from the UO table.  Thus it provides a tool to pass a UO table variable name to a function and have the value retrieved at a later point in execution.
+
luo stands for 'live uo' table, and it provides [http://en.wikipedia.org/wiki/Functor functor] methods that, when called, access the underlying values from the UO table.  Thus it provides a tool to pass a UO table variable name as an argument to a function and have the associated value retrieved at a later point in execution.
 +
 
 +
While similar functionality can be obtained by passing around strings, the live uo methods have the advantage of being of type 'function' and passing argument checks where functions are expected, obviating the need for special string validity checking.  Additionally, misspelled methods will raise a runtime error at the point that they are specified, whereas with a string passing mechanism an error may arise nonlocally.
  
 
== Live UO Methods ==
 
== Live UO Methods ==
  
There is a method for each corresponding name in the UO table.  Additionally, the following methods return tables of UO values with a single call:
+
There is a method for each corresponding name in the UO variables table.  Additionally, the following methods return tables of related UO values with a single call:
  
 
* [[luo.Char]]
 
* [[luo.Char]]
Line 43: Line 45:
  
 
== See Also ==
 
== See Also ==
 +
 +
* [http://www.easyuo.com/openeuo/wiki/index.php/Simplelib simplelib]
  
 
* [http://www.easyuo.com/openeuo/wiki/index.php/Documentation#Variables UO Variables]
 
* [http://www.easyuo.com/openeuo/wiki/index.php/Documentation#Variables UO Variables]

Latest revision as of 09:40, 2 November 2010

Calling Convention

Call

local l = sl.luo

Args

n/a

Result

l is a table with all live uo methods

Example Usage

local l = sl.luo
local waitforchange = function(old, live)
  while old == live() then
    wait(100)
  end
end
waitforchange(UO.Sex, l.Sex)
print('Something's very wrong!')

Description

luo stands for 'live uo' table, and it provides functor methods that, when called, access the underlying values from the UO table. Thus it provides a tool to pass a UO table variable name as an argument to a function and have the associated value retrieved at a later point in execution.

While similar functionality can be obtained by passing around strings, the live uo methods have the advantage of being of type 'function' and passing argument checks where functions are expected, obviating the need for special string validity checking. Additionally, misspelled methods will raise a runtime error at the point that they are specified, whereas with a string passing mechanism an error may arise nonlocally.

Live UO Methods

There is a method for each corresponding name in the UO variables table. Additionally, the following methods return tables of related UO values with a single call:

See Also