nomsu/lib/core/io.nom
Bruce Hill bf37295fae Updating to v6.15, which includes "external (...)" instead of separate
'externally' versions of stuff, and some auto-formatting.
2019-01-15 15:54:28 -08:00

31 lines
889 B
Plaintext

#!/usr/bin/env nomsu -V6.15.13.8
#
This file contains basic input/output code
use "core/metaprogramming"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external:
(say $message) compiles to:
lua> ("
if \$message.type == "Text" then
return LuaCode("say(", \($message as lua expr), ");");
else
return LuaCode("say(tostring(", \($message as lua expr), "));");
end
")
(say $message inline) compiles to:
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:
$io.write $prompt
return ($io.read())