diff --git a/docs/advanced/variables.md b/docs/advanced/variables.md index a1dde03..f77f797 100644 --- a/docs/advanced/variables.md +++ b/docs/advanced/variables.md @@ -95,3 +95,20 @@ Deleting a variable is done with the `variableControllerDelete`. ```js await takaro.variable.variableControllerDelete(variableId); ``` + +If a module created multiple variables, search for the variables first and delete each record by ID. For module cleanup, include the `moduleId` and `gameServerId` filters so you only delete data for the module on the intended game server. + +```js +const variables = await takaro.variable.variableControllerSearch({ + filters: { + gameServerId: [gameServerId], + moduleId: [mod.moduleId], + }, +}); + +for (const variable of variables.data.data) { + await takaro.variable.variableControllerDelete(variable.id); +} +``` + +Uninstalling a module from a game server does not delete variables created by that module. Delete variables separately when you want to remove saved module data. diff --git a/docs/modules/debugging.md b/docs/modules/debugging.md index 392d9d7..8413cab 100644 --- a/docs/modules/debugging.md +++ b/docs/modules/debugging.md @@ -28,6 +28,8 @@ Useful fields often include errors, arguments, player data, game server IDs, mod If the issue involves saved module data, also check the variables created by the module. For example, the teleport module stores player teleport locations as variables linked to the player, game server, and module. +If you need to remove saved module data, delete the relevant variables. See [Deleting variables](/advanced/variables#deleting-a-variable) for the API pattern. + ## Share event JSON when asking for help If you ask us for help with a module issue, include the event JSON. It gives us the exact data Takaro saw when the module ran and helps us debug the problem faster. diff --git a/docs/modules/install-configure.md b/docs/modules/install-configure.md index 64bfb0e..1cf5a94 100644 --- a/docs/modules/install-configure.md +++ b/docs/modules/install-configure.md @@ -61,9 +61,11 @@ Tagged module versions are immutable. The `latest` version is useful while devel ## Remove a module -Uninstalling a module stops its commands, hooks, and cronjobs from running on that game server. It doesn't automatically clean up all data that the module may have stored. +Uninstalling a module removes the module installation and configuration for that game server. The module's commands, hooks, and cronjobs stop running on that server. -Before removing a module that stores variables, check whether you need to export, migrate, or manually delete that data. +Uninstalling a module does not delete variables created by that module. Variables are scoped to the module and game server, but they remain after the module installation is removed. + +Before uninstalling a module that stores variables, check whether you need to export, migrate, or manually delete that data. See [Deleting variables](/advanced/variables#deleting-a-variable) for the API pattern. ## Troubleshooting