49
edits
| (7 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{dev/uiccmd}} | {{dev/uiccmd}} | ||
Runs a Lua statement in a Lua runtime. | Runs a Lua statement in a Lua runtime. | ||
<kua>lua run | <kua>lua run `print("fred")`</kua> | ||
== Arguments == | == Arguments == | ||
| Line 15: | Line 15: | ||
=== Default values === | === Default values === | ||
<kua> | <kua> | ||
lua run | lua run `print(1 + 2)` | ||
</kua> | </kua> | ||
: Prints '3'. | : Prints '3'. | ||
<kua> | <kua> | ||
lua run | context lua | ||
run `print(1 + 3)` | |||
run `print(1 + 4)` | |||
exit | |||
</kua> | |||
: Prints '4' and '5'. | |||
<kua> | |||
lua run ` | |||
print(1 + 5) | |||
print(1 + 6) | |||
` | |||
</kua> | </kua> | ||
: Prints ' | : Prints '6' and '7'. | ||
<kua> | <kua> | ||
context lua | context lua | ||
run | run ` | ||
bob = 1 + 7 | |||
if bob > 4 then | |||
bob = "james" | |||
end | |||
` | |||
return bob -- uses the 'lua' context 'lua_edit' default command, which can print return values | |||
exit | |||
</kua> | </kua> | ||
: Prints ' | : Prints 'james'. | ||
== Notes == | == Notes == | ||
* | * | ||