ScriptUO

Scripting Resources & Utilities => OEUO => OpenEUO Scripting Chat => Topic started by: TrailMyx on September 09, 2010, 07:12:11 PM

Title: I have a really cool namespace interaction routine set coming
Post by: TrailMyx on September 09, 2010, 07:12:11 PM
There's a few people that have learned how nice it is to use namespaces from within EUO to manage data.  Unfortunately, when you try and apply that concept to something similar within OEUO, you tend to find it difficult to port such code.  So I've written a group of routines that roughly mimicks the functionality of namespace operations.  Here's an example:

Code: [Select]
var = TM_NS:New()                      
var:Switch("local","ns1")              
var:Write("var1",5)                    
var:Write("var2",10)                    
var:Write("var3",20)                    
var:Write("vv3",30)      
var:Push()              
var:CopyTo("global","ns2","var") -- just copy everything starting with "var" to global:ns2
                                        
print(var:ReadAbs("global","ns2","var1"))
print(var:ReadAbs("global","ns2","var2"))
print(var:ReadAbs("global","ns2","var3"))
print(var:ReadAbs("global","ns2","vv3"))

results in:

Quote
5
10
20
nil

These routines are very fast since they employ hash table lookup for both the namespace reference as well as the individual namespace data entries.
More to come...