Cool VL Viewer forum http://sldev.free.fr/forum/ |
|
Lua scripting related requests http://sldev.free.fr/forum/viewtopic.php?f=9&t=1737 |
Page 3 of 10 |
Author: | Henri Beauchamp [ 2017-02-24 21:49:58 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Post subject: | Re: Lua scripting related requests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
To achieve what you want, you may simply split your program into several *.lua files, then specify the said files (in the proper order, so that the main program that will call functions defined in other files, will be specified last) to luac:
You could also use a pre-processor (like "cpp" in C/C++)... AFAIK, there is no official pre-processor for luac, but (under Linux, or with mingw/cygwin under Windows) you could just use cpp itself, using #include "some_included_lua_file.lua" in your main automation.lua "sources". Example for automation.lua:
Example for my_lua_functions.lua:
Then, using cpp to assemble your Lua script and pass it to luac:
The "-P" option instructs cpp not to add its own comments/references in the output file (since luac won't understand them), "-nostdinc" tells it not to search for C headers outside the current directory (where both your "my_lua_functions.lua" and "automation.lua" should reside: if "my_lua_functions.lua" is elsewhere you can tell cpp with its "-I" option where to look for), and "-pipe" allows to send the resulting pre-processed sources to the standard output, which gets connected to the standard input of luac thanks to the pipe ("|") character and the "-" last option in luac's command line. Now, check that it worked:
As a bonus, you could use most cpp directives (#define, #if/#else/#endif, etc) in your code... |
Author: | ZaneZimer [ 2017-02-25 00:25:03 ] | |||||||||
Post subject: | Re: Lua scripting related requests | |||||||||
Great info, Henri. Thank you. The cpp trick was something I hadn't considered. I was trying for an all Lua solution. I did managed to get something interesting going as follows:
|
Author: | ZaneZimer [ 2017-02-28 14:47:12 ] |
Post subject: | Re: Lua scripting related requests |
What is the maximum size limit of the global/per account data items? I am currently serializing a relatively small 'config' table into the per account data but I do not wish to overrun the limits. Any thoughts on using notecards for holding and reading in larger bits of data? Maybe in a read only capacity? Cheers |
Author: | Henri Beauchamp [ 2017-03-01 00:10:23 ] | ||||||||||||||||||
Post subject: | Re: Lua scripting related requests | ||||||||||||||||||
That's the limit of a string in a LLSD representation: practically "unlimited" (I just made a try with a 5+ millions characters string with SetGlobalData()/GetGlobalData() and it did work)...
|
Author: | ZaneZimer [ 2017-03-01 00:19:58 ] | ||||||||||||||||||
Post subject: | Re: Lua scripting related requests | ||||||||||||||||||
|
Author: | ZaneZimer [ 2017-03-18 20:00:37 ] |
Post subject: | Re: Lua scripting related requests |
Should the OnWindlightChange() event fire when 'Revert to region default' is selected? or any of the 'time of day' selections? |
Author: | Henri Beauchamp [ 2017-03-23 16:38:08 ] | |||||||||
Post subject: | Re: Lua scripting related requests | |||||||||
Both OnWindlightChange() and ApplySkySettings() will be extended to take those into account. |
Author: | ZaneZimer [ 2017-03-25 19:50:59 ] | |||||||||
Post subject: | Re: Lua scripting related requests | |||||||||
|
Author: | Henri Beauchamp [ 2017-03-25 23:10:41 ] | |||||||||
Post subject: | Re: Lua scripting related requests | |||||||||
|
Author: | ZaneZimer [ 2017-03-25 23:35:34 ] | |||||||||
Post subject: | Re: Lua scripting related requests | |||||||||
|
Page 3 of 10 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |