This shows you the differences between two versions of the page.
lua:loadscriptfunction [2014/12/27 07:51] vodur created |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | 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 [[:lua:loadprogfunction|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. | ||