server_settings.Bool
From GMod Wiki
Revision as of 14:59, 13 September 2009 by UnrealomegaBot (Talk | contribs)
Function | |
Syntax |
server_settings.Bool( String name, Integer default ) Where is this used? |
Description: | |
Returns whether the named server setting is true or false. | |
Returns: | Boolean |
Part of Library: | server_settings |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Server settings.Bool]Server settings.Bool [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Example
Description | Checks if cheats are enabled. |
---|---|
Used on | |
Code | local cheats = server_settings.Bool( "sv_cheats", 0 ); |
Output | N/A |
Additional Notes
Internally, there is no concept of boolean to a server setting, so results are based on whether the variable is set to a 1 or 0, which mimics a boolean value.
This function makes use of server_settings.Int and compares its result to zero to see if the setting is true or not. It does this by setting default to 1 if default is given a true value, 0 otherwise. Thus, default could be given any sort of value, so long as it is true. Be aware 0 and "0" are true in Lua. Only false and nil have falseness.