CEL in CELX scripts
Posted: 13.03.2004, 12:40
Hi,
as already mentioned CELX-scripts can now include the source of CEL-scripts. This feature is available as of v1.3.2pre6.
I think the easiest way to use it is this:
- include this function at the top of your CELX-script:
UPDATE: Corrected stupid error (didn't check if the CEL-script had ended)
- below this enclose any CEL-scripts like this:
That's it. Note: the [[...]] is just a special way to define a string in Lua, instead of using "...". This way you don't have to escape any "" within the CEL-script, but better make sure there is no "]]" within the CEL-script.
You can execute an arbitrary number of CEL-scripts like this, one after the other, and add some Lua-commands between them.
Or maybe split a CEL-script in multiple smaller scripts, which then can be executed conditionally (for example after receiving a keypress).
Harald
as already mentioned CELX-scripts can now include the source of CEL-scripts. This feature is available as of v1.3.2pre6.
I think the easiest way to use it is this:
- include this function at the top of your CELX-script:
UPDATE: Corrected stupid error (didn't check if the CEL-script had ended)
Code: Select all
function CEL(source)
local script = celestia:createcelscript(source)
while script:tick() do
wait(0)
end
end
- below this enclose any CEL-scripts like this:
Code: Select all
CEL([[
{
...
}
]])
That's it. Note: the [[...]] is just a special way to define a string in Lua, instead of using "...". This way you don't have to escape any "" within the CEL-script, but better make sure there is no "]]" within the CEL-script.
You can execute an arbitrary number of CEL-scripts like this, one after the other, and add some Lua-commands between them.
Or maybe split a CEL-script in multiple smaller scripts, which then can be executed conditionally (for example after receiving a keypress).
Harald