From e98271ddc389b54cd3514466116dfcd8acef2237 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 16 Jan 2023 13:53:16 -0800 Subject: [PATCH] document that enableable scripts must also be modules --- docs/dev/Lua API.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index 813406013..ab7d6434e 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -5812,9 +5812,13 @@ Enabling and disabling scripts ============================== Scripts can choose to recognize the built-in ``enable`` and ``disable`` commands -by including the following line anywhere in their file:: +by including the following line near the top of their file:: - --@ enable = true + --@enable = true + --@module = true + +Note that enableable scripts must also be `modules ` so their +``isEnabled()`` functions can be called from outside the script. When the ``enable`` and ``disable`` commands are invoked, the ``dfhack_flags`` table passed to the script will have the following fields set: @@ -5829,7 +5833,8 @@ command. Example usage:: - --@ enable = true + --@enable = true + --@module = true enabled = enabled or false function isEnabled()