geode.Mod reads the host mod metadata, paths, saved values, and settings.
It can also listen for setting changes.
geode.Mod.getSavedValue(key: string) -> (any?, string?)Reads a value from the mod save file.
Values are JSON types:
- boolean
- number
- string
- table
- array
null(returnsnilin Luau)
A missing key returns nil only.
A stored JSON null also returns nil only.
Recoverable read or conversion failures return nil and an error message.
See globals Error shapes.
geode.Mod.setSavedValue(key: string, value: any) -> (boolean?, string?)Writes a JSON value to the mod save file.
Returns true on success. Returns nil and an error message when conversion or save fails.
geode.Mod.getSettingValue(key: string) -> (any?, string?)Reads a mod setting from mod.json. Returns nil when the key is missing or the read fails.
geode.Mod.hasSetting(key: string) -> booleanReturns true when the setting key exists in mod.json.
geode.Mod.listenForSettingChanges(key: string, callback: (value: any) -> ())Calls your function whenever the setting with this key changes. The listener stays active until the script unloads.
geode.Mod.listenForAllSettingChanges(callback: (key: string, value: any) -> ())Calls your function whenever any setting for this mod changes. It gets the key and the new value.
geode.Mod.getID() -> string
geode.Mod.getName() -> string
geode.Mod.getVersion() -> stringgetID returns the mod id, for example my.mod.id.
Use it as the prefix when you call :setID() on nodes you create. See game objects.
geode.Mod.getResourcesDir() -> string
geode.Mod.getSaveDir() -> string
geode.Mod.getConfigDir() -> string
geode.Mod.getPersistentDir() -> stringReturn the paths to the mod resources, save, config, and persistent folders. Script files live in resources.
Saved values and settings use the JSON model. Depth and parse size limits match json. See Limits and errors for caps and error strings.
geode.Mod.setSavedValue("count", 3)
print(geode.Mod.getSavedValue("count"))
geode.Mod.listenForSettingChanges("my-toggle", function(value)
print("my-toggle is now", value)
end)src/bindings/geode/GeodeModBinding.cpptools/luau_codegen/extra_bindings/mod.dluau