Declaration
ok, store = GetDataStore(string name, string scope = “global”, bool all_scope = false)
Parameters
Parameter Name | Description |
---|---|
name | Name of a datastore, which is a unique identifier. Data in datastores with the same name is saved in the same data space. |
scope | Domain name of a datastore, where data is stored independently by scope. If all_scope is set to false, all data keys in the datastore are prefixed with scope by default. Otherwise, you need to specify scope in data keys. |
all_scope | Specifies whether the obtained datastore can access all data in the domain across scopes. If the value is true, you need to specify scope in a data key, for example, use the scope:key format to access data. |
Return Values
Index | Type | Description |
---|---|---|
1 | int | If the value is 0, the operation is successful. The subsequent field is the obtained datastore. |
2 | string or ParaDataStore | If the operation is successful, the obtained ParaDataStore is returned. Otherwise, an error message is returned. |
Description
Creates or gets a datastore object.
Data is stored in a key-value format, and the value can be any data type like number, string, boolean, or table. Besides, cross-scope search and prefix search are supported.