'say' is now it's own action, rather than a 'print' clone, which lets it
handle multiple arguments better.
This commit is contained in:
parent
e181c66ae4
commit
364f3c894b
@ -3,27 +3,20 @@
|
|||||||
This file contains basic input/output code
|
This file contains basic input/output code
|
||||||
|
|
||||||
use "core/metaprogramming"
|
use "core/metaprogramming"
|
||||||
|
use "core/operators"
|
||||||
|
use "core/control_flow"
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
external:
|
external:
|
||||||
(say $message) compiles to:
|
(say (*extra arguments*)) means:
|
||||||
lua> ("
|
for $ in 1 to (select "#" (*extra arguments*)):
|
||||||
if \$message.type == "Text" then
|
$arg = (select $ (*extra arguments*))
|
||||||
return LuaCode("say(", \($message as lua expr), ");");
|
$io.write ($arg as text)
|
||||||
else
|
$io.write "\n"
|
||||||
return LuaCode("say(tostring(", \($message as lua expr), "));");
|
$io.flush()
|
||||||
end
|
|
||||||
")
|
|
||||||
|
|
||||||
(say $message inline) compiles to:
|
(say $message inline) means ($io.write $message)
|
||||||
lua> ("
|
|
||||||
if \$message.type == "Text" then
|
|
||||||
return LuaCode("io.write(", \($message as lua expr), ")");
|
|
||||||
else
|
|
||||||
return LuaCode("io.write(tostring(", \($message as lua expr), "))");
|
|
||||||
end
|
|
||||||
")
|
|
||||||
|
|
||||||
(ask $prompt) means:
|
(ask $prompt) means:
|
||||||
$io.write $prompt
|
$io.write $prompt
|
||||||
|
Loading…
Reference in New Issue
Block a user