[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: LU's words
- From: PA <petite.abeille@...>
- Date: Thu, 3 Feb 2005 21:35:27 +0100
Hello,
In case if anyone is interested, here is a small glossary of LU's words
(sic):
"class" == package (module?)
"object" == table of functions
"instance" == a copy of a table of functions
"method" == function
So far, LU defines 8 classes:
(1) LUObject is the root class. Every other classes are derived from
it. It defines 7 instance methods: conformsTo, equals, hashCode,
isKindOf, respondsTo, self and toString. And 4 class methods: extend,
isKindOf, new, toString. The extend class method is how one create
subclasses:
-- extend the super class
local thisClass, superClass = LUObject.extend( LUObject )
-- extend the super class instance
local this, super = superClass.extend( superClass.new() )
http://dev.alt.textdrive.com/file/lu/LUObject.lua
(2) LUClass provides most of the introspection mechanisms. It defines 9
instance methods: bundle, classMethodNames, classMethodWithName,
entity, methodNames, methodWithName, name, superclass, toString. And 3
class methods: classNames, classWithName, new.
LULog.debug( LUClass.new( LUObject ).methodNames() )
http://dev.alt.textdrive.com/file/lu/LUClass.lua
(3) LUBundle provides "location" awareness to the system. It defines 6
instance methods: entity, name, path, pathForResource, resourcePath,
toString. And 5 class methods: bundleNames, bundleWithName,
nameWithPath, new, separator.
LULog.debug( LUBundle.new( LUBundle ).resourcePath() )
http://dev.alt.textdrive.com/file/lu/LUBundle.lua
(4) LUList is a glorified wrapper around Lua's native table. It defines
13 instance methods: add, addAll, clear, equals, get, indexOf, load,
remove, shuffle, size, sort, store, toString. And 1 class method: new.
Of interest are the toString method which builds a string
representation of the list and load and store which can persist a list
to file.
LULog.debug( LUList.new().addAll( { 1, 2, 3 } ).store( LUBundle.new(
LUList ).path().."list.txt" ) )
http://dev.alt.textdrive.com/file/lu/LUList.lua
(5) LUMap is a glorified wrapper around Lua's native table. It defines
13 instance methods: clear, equals, get, hasKey, hasValue, keys, load,
put, putAll, size, store, toString, values. And 1 class method: new. Of
interest are the toString method which builds a string representation
of the map and load and store which can persist a map to file.
LULog.debug( LUMap.new().putAll( _G ).keys() )
http://dev.alt.textdrive.com/file/lu/LUMap.lua
(6) LUDate is a glorified wrapper around Lua's native os.time and
os.date functionalities. It presently defines 11 instance methods:
date, day, dayOfWeek, dayOfYear, hour, minute, month, second, time,
toString, year. And 2 class methods: dateWithValues, new. This class is
going to grow to handle all sort of date arithmetics.
LULog.debug( LUDate.new() )
LULog.debug( LUDate.dateWithValues( { year = 1970, month = 1, day = 1 }
) )
http://dev.alt.textdrive.com/file/lu/LUDate.lua
(7) LUTask is a glorified wrapper around Lua's native coroutine. It
presently defines instance methods: resume, run, status, target, yield.
And class methods: loop, new, register, run, tasks.
http://dev.alt.textdrive.com/file/lu/LUTask.lua
(8) LULog is a glorified wrapper around Lua's native print function. It
defines 6 class methods: debug, error, info, new, trace, warning. There
are now instance methods.
http://dev.alt.textdrive.com/file/lu/LULog.lua
Check Example.lua for, well, usage examples :P
http://dev.alt.textdrive.com/file/lu/Example.lua
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/