Making Lua Code More Concise and Expressive
;/;/;/;/;/;/
Lua is a fast, lightweight, and versatile programming language. However, its writing can be a bit verbose, especially for complex scripts. MoonScript comes as a solution to deal with this problem. Here’s my summary!
;/;/;/;/;/;/
;/;/;/;/;/;/
[install lua]
#apt install lua5.3 -y
;/;/;/;/;/;/
;/;/;/;/;/;/
[install module]
#apt install luarocks -y
#luarocks install moonscript
;/;/;/;/;/;/
;/;/;/;/;/;/
[convert file]
#moonc -p filename.moon
#moonc -o nama_file.lua nama_file.moon
;/;/;/;/;/;/
;/;/;/;/;/;/
"before conversion"
greet = (name) ->
print "Hello, #{name}!"
greet "World"
;/;/;/;/;/;/
;/;/;/;/;/;/
"after conversion"
function greet(name)
print("Hello, " .. name .. "!")
end
greet("World")
;/;/;/;/;/;/
;/;/;/;/;/;/