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")

;/;/;/;/;/;/
;/;/;/;/;/;/

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response