Zippy-Egoboo Home EgoWiki > Documentation > ZippyNamespaces (r1.1 vs. r1.2) EgoWiki webs:
Main | TWiki | Know | Sandbox
Documentation . { Changes | Index | Search | Go }
 <<O>>  Difference Topic ZippyNamespaces (r1.2 - 08 Mar 2004 - ElminI)
Added:
>
>

A reference implementation in plain Lua for Namespaces is available: zlnamespace.lua.


 <<O>>  Difference Topic ZippyNamespaces (r1.1 - 29 Jan 2004 - ElminI)
Added:
>
>

%META:TOPICINFO{author="ElminI" date="1075413698" format="1.0" version="1.1"}% %META:TOPICPARENT{name="MakingZippyObjects"}% Namespaces are collections of fields where each collection is associated with a global variable. Namespaces may be defined with the following syntax:

Namespace{ "namespace_name";
   field = value,
}

Where "field," "value," and "namespace_name" may be replaced with the named quantities.

The fields will thereafter be available as members of the namespace as follows:

namespace_name.field

Namespaces may additionally contain placeholders indicating that the value for a field may be obtained by loading another file. These take the following form:

Namespace{ "name";
   external_field = in_file("path/to/file.lua"),
}

These fields will not be accessible until they are "required;" this may be indicated with the "Require" function:

Require(name.external_field)

If a file must be loaded to obtain the value for a required field, it will be loaded during the call to "Require."

Certain functions (for example, ActionClass and register_type) will allow a namespace to be specified as a field of the argument table:

register_type{
   name = "CharacterClass",
   namespace = Basic,
    -- ...
}

This will add the field "CharacterClass" in the already-declared namespace "Basic" with the value being the class itself.

-- ElminI - 29 Jan 2004


Topic ZippyNamespaces . { View | Diffs | r1.2 | > | r1.1 | More }
Revision r1.1 - 29 Jan 2004 - 22:01 GMT - ElminI
Revision r1.2 - 08 Mar 2004 - 03:39 GMT - ElminI
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding EgoWiki? Send feedback.