External Code & External Library

External Code & External Library

With this short tutorial, you learn how to insert your own lua library into Kwik.

for isntance, mylibrary.lua just prints out what layers are included in a page

local _M = {}
_M.print = function(layer)
  for k,v in pairs(layer) do
    print (k)
return _M

mydebug.lua is just to print myLib.print(layer) passing layer to the parameter. The layer is a table which collects each display object generated from photoshop layer

and then external code - mydebug.lua uses mylibrary to execute the print function. It is just one line code.


you can find mylibrary.lua and mydebug.lua in the following zip.


Add External Library

From Project&Properties, click Add External Library

Then click + icon

Select mylibrary.lua and name it as myLib

Add External Code

Project and Pages > Add External Code

mydebug.lua is selected

Layer life cycle is like this. Because of some internal process of Kwik, please notice the location of After layers is just before making display objects.

Now you know how to extend Kwik generated lua files with your own codes. When you modify your lua files, you need to click Publish icon to update.