Dofile
From MaratisWiki
(Difference between revisions)
Dahnielson (Talk | contribs) |
|||
| (One intermediate revision by one user not shown) | |||
| Line 1: | Line 1: | ||
{{lua-function|dofile|file}} | {{lua-function|dofile|file}} | ||
| − | + | Use this command to include additional lua files. | |
| − | '''Example | + | {{lua-function-param|file|local path of the lua file to include}} |
| + | <br> | ||
| + | |||
| + | Finding the local path : | ||
| + | |||
| + | /scripts/main.lua' -> from here call dofile("other/additional.lua")<br> | ||
| + | /scripts/other/additional.lua<br> | ||
| + | |||
| + | /scripts/something/main.lua -> from here call dofile("../other/additional.lua")<br> | ||
| + | /scripts/other/additional.lua<br> | ||
| + | |||
| + | |||
| + | '''Example :''' This script will add an external light effect library | ||
dofile("lights/lightsfx.lua") | dofile("lights/lightsfx.lua") | ||
Latest revision as of 11:06, 6 April 2014
dofile(file)
Use this command to include additional lua files.
-
file: local path of the lua file to include
Finding the local path :
/scripts/main.lua' -> from here call dofile("other/additional.lua")
/scripts/other/additional.lua
/scripts/something/main.lua -> from here call dofile("../other/additional.lua")
/scripts/other/additional.lua
Example : This script will add an external light effect library
dofile("lights/lightsfx.lua")
light = getObject("Light")
function onSceneUpdate()
flickerLightEffects(light)
end