Set: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
Line 11: | Line 11: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''settingName:''' The name of the setting you want to set. See [[settings system#Setting names|setting names]] for information on settings names. | *'''settingName:''' The name of the setting you want to set. See [[settings system#Setting names|setting names]] for information on settings names. | ||
*'''value:''' The value to set the setting to. This can be any Lua data type, except for functions, most userdata (only [[resource]]s can be stored) and threads. | *'''value:''' The value to set the setting to. This can be any Lua data type, except for functions, most userdata (only [[resource]]s can't be stored) and threads. | ||
===Returns=== | ===Returns=== |
Revision as of 01:55, 3 January 2008
This article needs checking. | |
Reason(s): get allows retrieval of multiple values if the setting has multiple values in the settings.xml (e.g. [ "hah1","hah2","hah3" ] retrieves "hah1","hah2","hah3"). set however does not allow for setting these multiple values, even though get can retrieve them. The only way to set multiple values to a setting is to modify the xml. Therefore unlimited params should be given to set. |
This function is used to save arbitrary data under a certain name on the settings registry.
Syntax
bool set ( string settingName, var value )
Required Arguments
- settingName: The name of the setting you want to set. See setting names for information on settings names.
- value: The value to set the setting to. This can be any Lua data type, except for functions, most userdata (only resources can't be stored) and threads.
Returns
Returns true if the setting has been set, false if you do not have access to the setting or invalid arguments were passed.
Example
This example sets a setting called respawnTime with a value of 1000. This is a local setting belonging to the resource that the code is run in.
set ( "respawnTime", 1000 )
See Also