Set: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: <div style="border: 12px dotted #901010;padding:8px;margin:10px;"> This function needs to be documented. Please see Settings Proposal.</div>)
 
No edit summary
Line 1: Line 1:
<div style="border: 12px dotted #901010;padding:8px;margin:10px;">
__NOTOC__
This function needs to be documented. Please see [[Settings Proposal]].</div>
{{Server function}}
This function is part of the [[settings system]]. It can be used to save arbitrary data for future use.
 
==Syntax==
<syntaxhighlight lang="lua">
bool set ( string settingName, var value )
</syntaxhighlight>
 
===Required Arguments===
*'''settingName:''' The name of the setting you want to set. See [[settings system#names]] for information on settings names.
*'''value:''' The value to set the setting to. This can be any data type, except for elements.
 
===Returns===
Returns the ''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.
<syntaxhighlight lang="lua">
set ( "respawnTime", 1000 )
</syntaxhighlight>
 
==See Also==
{{Settings_functions}}

Revision as of 11:45, 14 September 2007

This function is part of the settings system. It can be used to save arbitrary data for future use.

Syntax

bool set ( string settingName, var value )

Required Arguments

  • settingName: The name of the setting you want to set. See settings system#names for information on settings names.
  • value: The value to set the setting to. This can be any data type, except for elements.

Returns

Returns the 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

Template:Settings functions