Add External Code
The Add External Code window allows you to add Lua code into your project. When pressed, the following window appears:
Name: enter a name to your block of code (this is needed in the case you need to edit the code later). Kwik auto create a name but it is always a good idea to enter your own names for easy access later;
From file (use the Browse button to point to the external code file): gets the file containing the external code (it will be copied into the page file during the Publish process).
Before layers, After layers, After buttons and actions and Disposal: defines where the block of code will be entered in your page.
Before layers blocks will be added before the page layers rendering. This will be added in the scene:create part of the code.
After layers blocks will be rendered just after the layers and groups creation. This will be added in the scene:create part of the code.
After buttons and actions blocks will be rendered after the buttons and actions are process. This will be added in the scene:show part of the code.
Disposal: blocks will be rendered in the disposal area – scene:hide. This is used to cleanup animations, events, etc. This allows, for example, the removal of event listeners created using external code.
Kwik4 ‘s global table is _K
local _K = require “Application”
Local variable made with Create Variable is stored in UI table.
``` UI.YOUR_VARIABLE = 1