aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/target/lua.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/target/lua.lux31
1 files changed, 18 insertions, 13 deletions
diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux
index 5389a8bc8..12885861e 100644
--- a/stdlib/source/library/lux/target/lua.lux
+++ b/stdlib/source/library/lux/target/lua.lux
@@ -27,10 +27,15 @@
[type
abstract]]])
+... Added the carriage return for better Windows compatibility.
+(def: \n+
+ Text
+ (format text.carriage_return text.new_line))
+
(def: nested
(-> Text Text)
(.let [nested_new_line (format text.new_line text.tab)]
- (|>> (format text.new_line)
+ (|>> (format \n+)
(text.replaced text.new_line nested_new_line))))
(def: input_separator ", ")
@@ -248,7 +253,7 @@
(-> Statement Statement Statement)
(:abstraction
(format (:representation pre!)
- text.new_line
+ \n+
(:representation post!))))
(def: locations
@@ -275,29 +280,29 @@
(def: .public (if test then! else!)
(-> Expression Statement Statement Statement)
(:abstraction (format "if " (:representation test)
- text.new_line "then" (..nested (:representation then!))
- text.new_line "else" (..nested (:representation else!))
- text.new_line "end")))
+ \n+ "then" (..nested (:representation then!))
+ \n+ "else" (..nested (:representation else!))
+ \n+ "end")))
(def: .public (when test then!)
(-> Expression Statement Statement)
(:abstraction (format "if " (:representation test)
- text.new_line "then" (..nested (:representation then!))
- text.new_line "end")))
+ \n+ "then" (..nested (:representation then!))
+ \n+ "end")))
(def: .public (while test body!)
(-> Expression Statement Statement)
(:abstraction
(format "while " (:representation test) " do"
(..nested (:representation body!))
- text.new_line "end")))
+ \n+ "end")))
(def: .public (repeat until body!)
(-> Expression Statement Statement)
(:abstraction
(format "repeat"
(..nested (:representation body!))
- text.new_line "until " (:representation until))))
+ \n+ "until " (:representation until))))
(def: .public (for_in vars source body!)
(-> (List Var) Expression Statement Statement)
@@ -307,7 +312,7 @@
(text.interposed ..input_separator))
" in " (:representation source) " do"
(..nested (:representation body!))
- text.new_line "end")))
+ \n+ "end")))
(def: .public (for_step var from to step body!)
(-> Var Expression Expression Expression Statement
@@ -318,7 +323,7 @@
..input_separator (:representation to)
..input_separator (:representation step) " do"
(..nested (:representation body!))
- text.new_line "end")))
+ \n+ "end")))
(def: .public (return value)
(-> Expression Statement)
@@ -330,7 +335,7 @@
..locations
(text.enclosed ["(" ")"]))
(..nested (:representation body!))
- text.new_line "end")
+ \n+ "end")
(text.enclosed ["(" ")"])
:abstraction))
@@ -343,7 +348,7 @@
..locations
(text.enclosed ["(" ")"]))
(..nested (:representation body!))
- text.new_line "end")))]
+ \n+ "end")))]
[function "function"]
[local_function "local function"]