From 2e0b95bbd4eb7d2282b2281c51e942687e01d7df Mon Sep 17 00:00:00 2001 From: Petr Mikheev Date: Sat, 29 Jan 2022 23:18:41 +0000 Subject: [PATCH] Update docs/source/reference/lua-scripting/engine_handlers.rst, docs/source/reference/lua-scripting/overview.rst --- docs/source/reference/lua-scripting/engine_handlers.rst | 3 +++ docs/source/reference/lua-scripting/overview.rst | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/source/reference/lua-scripting/engine_handlers.rst b/docs/source/reference/lua-scripting/engine_handlers.rst index 4f5f99965a..46e648d620 100644 --- a/docs/source/reference/lua-scripting/engine_handlers.rst +++ b/docs/source/reference/lua-scripting/engine_handlers.rst @@ -19,6 +19,9 @@ Engine handler is a function defined by a script, that can be called by the engi | onLoad(savedData, initData) | | Called on loading with the data previosly returned by | | | | onSave. During loading the object is always inactive. initData is | | | | the same as in onInit. | +| | | Note that onLoad means loading a script rather than loading a game.| +| | | If a script did not exist when a game was saved onLoad will not be | +| | | called, but onInit will. | +----------------------------------+----------------------------------------------------------------------+ | onInterfaceOverride(base) | | Called if the current script has an interface and overrides an | | | | interface (``base``) of another script. | diff --git a/docs/source/reference/lua-scripting/overview.rst b/docs/source/reference/lua-scripting/overview.rst index fe8082a1a1..1bfdf33c42 100644 --- a/docs/source/reference/lua-scripting/overview.rst +++ b/docs/source/reference/lua-scripting/overview.rst @@ -251,8 +251,8 @@ The value that `onSave` returns will be passed to `onLoad` when the game is load It is the only way to save the internal state of a script. All other script variables will be lost after closing the game. The saved state must be :ref:`serializable `. -Note that `onLoad` means loading a script rather than loading a game. During loading a game `onLoad` works only for the scripts that were already existed when the game was saved (i.e. present in the save file). -If a completely new script was started (for example if it is a script of a newly installed mod) then the `onInit` handler is used even if it happened when loading a saved game. +Note that `onLoad` means loading a script rather than loading a game. +If a script did not exist when a game was saved then `onLoad` will not be called, but `onInit` will. `onSave` and `onLoad` can be called even for objects in inactive state, so it shouldn't use `openmw.nearby`.