User Tools

Site Tools


lua:loadscriptfunction

Loadscript works the same for CH, OBJ, and AREA objects.

A script file is loaded from the desginated folder and run as a prog.

Example:

ch1:loadscript("vodur", "testscript")

This will load the contents of 'testscript.lua' from the 'vodur' folder and run it as an mprog (assuming ch1 is a CH object).

This functionality is identical to loadprog. The reason to prefer loadscript would be the convenience of editing outside of olc, and a greater size limit. Prog scripts are limited to 10,000 characters whereas loadprog allows up to 100,000 characters to be loaded.

As with loadprog, if loadscript is used to load some common code into the scripting environment, it is good practice to have a check to ensure the code is only loaded once.

lua/loadscriptfunction.txt · Last modified: 2015/09/28 16:38 by vodur