49
edits
| Line 10: | Line 10: | ||
== Details == | == Details == | ||
The word "script" can be a very loose term in general, with lots of meanings. Here it can be even more confusing. | |||
In Engine, the most basic type of script is comprised of a core set of facilities in the Data module, which are composed of vars, cmds, aliases, binds, and contexts, with a very basic syntax. | |||
This very basic syntax structure however lends well to being flexible and extensible, and thus sometimes confusing. A complex base Engine script can interact with many different environments and contexts. | |||
n example test script named 'startup.cfg' can look like: | |||
<kua> | |||
context global | |||
bind Y "run startup.cfg" // reload this file | |||
alias testscript ' | |||
context lua | |||
{ | |||
print("Lua") | |||
local s = "" | |||
for i = 10, 1, -1 do | |||
s = s .. i .. " " | |||
end | |||
io.write(s) | |||
} | |||
exit | |||
context js | |||
{ | |||
print("JavaScript"); | |||
var s = ""; | |||
for (i = 10; i >= 1; i--) s += i + " "; | |||
print(s); | |||
} | |||
exit | |||
' | |||
bind U testscript | |||
</kua> | |||
== Examples == | == Examples == | ||