Loading Order of Lua Files

From GiderosMobile
Revision as of 14:28, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.png
Available since: Gideros 2020.5

Description

You can now implement Gideros Code Dependency by code instead of Gideros project setting. <syntaxhighlight lang="lua"> --!NEEDS:your_file.lua </source>

PS: the path is relative to the file in which you call --!NEEDS: (unless your path begins with a /)

This will tell Gideros to load your_file.lua before the file containing the above code.


The other Gideros Code Dependency you can implement by code is the exclude file. To tell Gideros the file should not be executed/parsed right on start but will be loaded through a require or a loadfile command, you can write: <syntaxhighlight lang="lua"> --!NOEXEC </source>


You can also assign a name to library files: <syntaxhighlight lang="lua"> --!LIBRARY:your_library_name </source>


This is very useful if you develop a Lua library that is meant to be used in several projects.

Examples

<syntaxhighlight lang="lua"> --!NEEDS:../../tiled/tiled_ellipse.lua --!NEEDS:luashader/luashader.lua

--!LIBRARY:GiderosUI ... --!NEEDS:(GiderosUI)/uistyle.lua

local function makeEffect(name,vshader,fshader) ... end </source>

See also

Require