Author Topic: I have a really cool namespace interaction routine set coming  (Read 4740 times)

0 Members and 1 Guest are viewing this topic.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
I have a really cool namespace interaction routine set coming
« on: September 09, 2010, 07:12:11 PM »
0
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...
« Last Edit: September 09, 2010, 09:22:56 PM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: TrailMyx  OEUO