diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/target/lua.lux | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/stdlib/source/lux/target/lua.lux b/stdlib/source/lux/target/lua.lux index 586b060a2..c557c7feb 100644 --- a/stdlib/source/lux/target/lua.lux +++ b/stdlib/source/lux/target/lua.lux @@ -100,11 +100,15 @@ #1 "true") :abstraction)) - (def: #export (int value) + (def: #export int (-> Int Literal) - (:abstraction (.if (i.< +0 value) - (%.int value) - (%.nat (.nat value))))) + ## Integers must be turned into hexadecimal to avoid quirks in how Lua parses integers. + ## In particular, the number -9223372036854775808 will be incorrectly parsed as a float by Lua. + (.let [to_hex (\ n.hex encode)] + (|>> .nat + to_hex + (format "0x") + :abstraction))) (def: #export float (-> Frac Literal) @@ -391,11 +395,18 @@ [1 [["error"] ["print"] - ["require"]]] + ["require"] + ["type"]]] [2 - []] + [["print"]]] [3 + [["print"]]] + + [4 + []] + + [5 []] ) |