Donut Team is a labor of love, built and maintained by a small group of passionate developers. We invest our own time and resources to offer our tools, mods, and web services completely free of charge.

We don't run ads, and we will never sell your data - period.

If you've enjoyed anything we've created, please consider supporting our work with a one-time or monthly donation via our Ko-fi page . Every contribution helps us continue building great experiences for the community.

Dismiss
  • Modding Tools
  • Lucas' Simpsons Hit & Run Mod Launcher
  • Hacks
  • Mod Requirable Hacks
  • Custom Files
  • Lua Functions
  • Mod Functions

GetSetting

Available since Version 1.7.

Returns the value of a setting in a mod.

Syntax

GetSetting( setting_name, [mod_name] )

Arguments

  • setting_name (string): The name of the setting to get the value of.
  • mod_name (string): The mod you want to get the setting from from.
    • Optional, defaults to the mod that called the function.

Return Values

  • (boolean | integer | number | string | nil): The value of the setting.
    • The type depends on the Type of the [Setting].
    • Returns nil if the setting does not exist or no such mod is loaded.

Examples

-- Get the difficulty setting of the current mod.
local Difficulty = GetSetting("Difficulty")

-- Check some other setting in another mod.
local SomeOtherSetting = GetSetting("SomeOtherSetting", "AnotherMod")

Version History

Version 1.23.10

Fixed an issue where the GetSetting and GetSettings functions read the low 32-bits of the 64-bit signed integer setting values as unsigned and casted that to a 64-bit signed integer to give it to Lua. This caused negative integer setting values to wrap as if they were 32-bit unsigned values.

Version 1.13

Made the GetSetting function return nil instead of throwing an error if a setting doesn't exist. Mod creators should do checks for nil on UncompiledOnly settings.

Version 1.12.1

Fixed a bug where using the GetSetting function on an Integer type Number setting would return a number.