CRegistry:GetStr CRegistry:SetBool

CRegistry:new


The new method is a class method which creates and returns a new CRegistry object.

Syntax

R = CRegistry:new( sKeyName )

bullet.gif    Creates a new CRegistry object by opening the named key.

R = CRegistry:new( CRegistry_old )

bullet.gif    This is a copy constructor. It opens a new CRegistry R initialized to the key used by CRegistry_old.

bullet.gif    On failure, nil is returned.

Remarks

Two overloads are provided for this method. They open a registry key or create separate access to the same key. The named key is opened for access if it exists. If the key does not exist, then it is created. The new method is equivalent to the Open method, so you can use either the new / delete pair or the Open / Close pair to open and close the key.

Example

The following script opens a key and retrieves the radius parameter. If the radius value does not exist in the Registry, the default value of 5.2 is returned.

R = CRegistry:new( "Script Test" )

-- open registry key "Script Test"

r = R:GetNum("radius", 5.2 )

-- fetch the "radius" value, default to 5.2

 

-- return value if it exists, else return 5.2

Printf("Rad= %lg", r )

-- result: Rad= 15.125 (already exists)

R:delete()

-- close access to the key

Related Topics

CRegistry class

Open

delete

new_registry

 


Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.