Ruby for Luau Developers
Move from Luau to Ruby through 48 multi-file tasks covering flow, blocks, collections, errors, classes, modules and inheritance. Build a lending desk and port two complete source programs.
Luau and Ruby side by side
The same program in Luau and in Ruby, from the lessons of this course.
Output and Comments
Luau runs top-level statements and uses double hyphens for comments, while Ruby uses a hash sign outside strings. The Coddy Luau CLI supplies io.write for exact output; Ruby print omits the final newline and puts adds one. A hash sign inside either quoted…
Luau1local name="Ada";print("Hello, "..name)Ruby1print "oak!"2# A real comment3puts "#seed"Conditional Values
Luau if-then-else expressions select a result directly, while Ruby if also yields its selected branch value. Luau expressions require the alternative and avoid the false-result pitfall of an and/or pseudo-ternary. Ruby can yield nil when no branch matches.…
Luau1local wet: boolean = false2local label = if wet then "rain" else "sun"3print(label)Ruby1wet = false2icon = if wet3 "umbrella"4else5 "sun"6end7puts iconArrays and Indexing
Luau dense sequences conventionally use one-based indexes, while Ruby arrays use zero-based indexes and negative positions count from the end. A Luau negative key is an ordinary table key. Missing reads yield nil in both examples. Luau sequence length and…
Luau1local values = {4, 8}2print(values[#values])3print(if values[9] == nil then "missing" else values[9])Ruby1values = [4, 8]2puts values[-1]3puts(values[9].nil? ? "missing" : values[9])Mutation and Aliases
Luau table assignment shares a reference, while table.clone copies the outer table. Ruby array assignment also aliases the object, reverse! mutates and reverse returns another outer array. Nested tables or arrays can remain shared after a shallow copy.…
Luau1local a={2};local b=table.clone(a);b[1]=8;print(a[1]..":"..b[1])Ruby1values = [1, 2, 3]2alias_values = values3values.reverse!4puts alias_values.join(" ")Modules as Namespaces
Luau modules commonly return tables through a host-provided require operation; the Coddy CLI supports relative module paths. Ruby require_relative loads neighboring files, while a declared module organizes constants and methods. A filename does not…
Luau1local Helpers={};function Helpers.twice(n)return n*2 end;print(Helpers.twice(4))Ruby1module TextTools2 def self.shout(text)3 text.upcase4 end5end6puts TextTools.shout("elm")Composing Objects
Luau tables and Ruby objects can retain collaborators by reference without cloning them. Typed Luau function or table shapes can constrain the interface during analysis, while Ruby commonly invokes compatible methods dynamically. Delegation allows behavior to…
Luau1local function service(policy)return {run=function(n)return policy(n)end}end;local s=service(function(n)return n*2 end);print(s.run(3))Ruby1class Lens2 def label; "wide"; end3end4class Camera5 def initialize(lens); @lens = lens; end6 def label; @lens.label; end7end8puts Camera.new(Lens.new).label
Syllabus
9 chapters48 lessons1 project48 challenges99 quiz questionsStart with Ruby
8 lessonsFlow and Methods
6 lessonsCollections and Blocks
6 lessonsMutation and Errors
5 lessonsObjects and State
5 lessonsComposition and Dispatch
6 lessonsObjects in Practice
6 lessonsLending Desk Project
4 lessonsPort Luau Programs
2 lessonsFrequently asked questions
Who is Ruby for Luau Developers for?
For people who already write Luau and want to learn Ruby. Each lesson starts from Luau you know and shows how Ruby does the same thing, so you skip the beginner basics.
Do I need to know Ruby already?
No. The course starts with your first Ruby program. You need Luau basics: variables, conditions, loops, functions and collections.
How many lessons does Ruby for Luau Developers have?
Ruby for Luau Developers contains 48 interactive lessons you can complete at your own pace.
What does Ruby for Luau Developers cover?
The course is organized into chapters covering: Start with Ruby, Flow and Methods, Collections and Blocks, Mutation and Errors, and more.
Is Ruby for Luau Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.