Open main menu
Home
Random
Log in
Settings
About AddOn Studio
Disclaimers
AddOn Studio
Search
Editing
Engine:CCMD lua.lua edit
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Details == Used to run a Lua text directly in the 'lua' context, if the first statement is not engine command, variable or alias in the 'lua' context. This allows the script in the 'lua' context to act as though it were running directly in a Lua console. While the 'lua' context has the ability to hold variables and aliases, they cannot be created from script as the 'lua' context has no 'alias', 'set' or 'var' type script commands added to the context. ; Line by line processing: The 'lua_edit' default command will only be run when a statement is not another context, or a command, variable, or alias. Script in the 'lua' context is still run statement by statement, as script in the engine. For example: <kua> context lua print(1+2); exit </kua> Is actually: <kua> context lua print(1+2) -- sent to Lua runtime ; // script statement delimiter processed in script exit // script </kua> This however would run ';' delimited statements in one Lua chunk, using the 'lua' context 'run' command. And then still run the script 'exit' command: <kua> context lua run `print(1+2);print(1+2)`;exit </kua> And this fails because 'if', 'print', and 'end' are in separate script statements: <kua> context lua if bob then -- Lua errer! print(1 + 2) end </kua> These work: <kua> context lua run `if bob then print(1 + 3) end` if bob then print(1 + 4) end </kua> ; Outer return statement: If the outer scope of the Lua code calls return, the return values will be printed. For example: <kua> context lua a = 1 return a return 100 + 1000 </kua> Will write '1' and '1100' to the engine log/console. This is similar to an interactive Lua console's '=' convenience command like <code>=100</code>, where will output '100' in the console when '=' starts a console line, after the command is run. In the engine real Lua interactive console, and this mechanism is special to only 'lua_edit', and is provided for similar convenience.
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)
Close
Loading editor…