From 8a3c32408733a2f5e14f8a2dbafa3f980b2f73a1 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 30 Dec 2018 19:04:34 -0800 Subject: Update to new syntax. --- core/io.nom | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'core/io.nom') diff --git a/core/io.nom b/core/io.nom index 4bf2028..1d8bac4 100644 --- a/core/io.nom +++ b/core/io.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V5.12.12.8 +#!/usr/bin/env nomsu -V6.12.12.8 # This file contains basic input/output code @@ -7,25 +7,28 @@ use "core/metaprogramming.nom" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (say $message) compiles to: - lua> " + lua> (" if \$message.type == "Text" then return LuaCode("say(", \($message as lua expr), ");"); else return LuaCode("say(tostring(", \($message as lua expr), "));"); - end" + end + ") (say $message inline) compiles to: - lua> " + 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" + end + ") (ask $prompt) compiles to: - lua> " + lua> (" if \$prompt.type == "Text" then return LuaCode("(io.write(", \($prompt as lua expr), ") and io.read())"); else return LuaCode("(io.write(tostring(", \($prompt as lua expr), ")) and io.read())"); - end" + end + ") -- cgit v1.2.3