24 lines
756 B
Plaintext
24 lines
756 B
Plaintext
#!/usr/bin/env nomsu -V4.8.8.6
|
|
#
|
|
This file contains basic input/output code
|
|
|
|
use "core/metaprogramming.nom"
|
|
|
|
compile [say %message] to (..)
|
|
lua> "\
|
|
..if \%message.type == "Text" then
|
|
return LuaCode(tree.source, "print(", \(%message as lua expr), ");");
|
|
else
|
|
return LuaCode(tree.source, "print(tostring(", \(%message as lua expr), "));");
|
|
end"
|
|
|
|
compile [ask %prompt] to (..)
|
|
lua> "\
|
|
..if \%prompt.type == "Text" then
|
|
return LuaCode.Value(tree.source, "(io.write(", \(%prompt as lua expr), ") and io.read())");
|
|
else
|
|
return LuaCode.Value(tree.source, "(io.write(tostring(", \(..)
|
|
%prompt as lua expr
|
|
.., ")) and io.read())");
|
|
end"
|