nomsu/lib/core/io.nom
Bruce Hill c1c32688a4 Overhaul in progress, mostly working. Moved all the nomsu packages into
lib/, including core/*. Changes to how nomsu environments and importing
work.
2019-01-14 15:43:24 -08:00

30 lines
801 B
Plaintext

#!/usr/bin/env nomsu -V6.14
#
This file contains basic input/output code
use "core/metaprogramming"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(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
")
externally (ask $prompt) means:
$io.write $prompt
return ($io.read())