Task

Demonstrate the language's ability to include source code from other files.




See Also
 Compiler/Simple file inclusion pre processor




-- load Lingo code from file
fp = xtra("fileIO").new()
fp.openFile(_movie.path&"someinclude.ls", 1)
code = fp.readFile()
fp.closeFile()
 
-- create new script member, assign loaded code
m = new(#script)
m.name = "someinclude"
m.scriptText = code
 
-- use it instantly in the current script (i.e. the script that contained the above include code)
script("someinclude").foo()