Menu
CoddyTech
Course

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.

  1. 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…

    Luau
    1local name="Ada";print("Hello, "..name)
    Ruby
    1print "oak!"2# A real comment3puts "#seed"
  2. 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.…

    Luau
    1local wet: boolean = false2local label = if wet then "rain" else "sun"3print(label)
    Ruby
    1wet = false2icon = if wet3  "umbrella"4else5  "sun"6end7puts icon
  3. Arrays 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…

    Luau
    1local values = {4, 8}2print(values[#values])3print(if values[9] == nil then "missing" else values[9])
    Ruby
    1values = [4, 8]2puts values[-1]3puts(values[9].nil? ? "missing" : values[9])
  4. 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.…

    Luau
    1local a={2};local b=table.clone(a);b[1]=8;print(a[1]..":"..b[1])
    Ruby
    1values = [1, 2, 3]2alias_values = values3values.reverse!4puts alias_values.join(" ")
  5. 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…

    Luau
    1local Helpers={};function Helpers.twice(n)return n*2 end;print(Helpers.twice(4))
    Ruby
    1module TextTools2  def self.shout(text)3    text.upcase4  end5end6puts TextTools.shout("elm")
  6. 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…

    Luau
    1local 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))
    Ruby
    1class 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 questions

More courses for Luau developers

Learn Ruby from another language

Frequently 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.

Coddy programming languages illustration

Start Ruby for Luau Developers for free

Get started