Menu
CoddyTech
Course

JavaScript for Lua Developers

Move from Lua tables and metatables to JavaScript arrays, Map, classes, and ES modules. Compare truthiness, indexing, multiple returns, closures, receivers, and errors, then build an order processor.

Lua and JavaScript side by side

The same program in Lua and in JavaScript, from the lessons of this course.

  1. Concatenation to Templates

    Lua concatenates text with double dots and commonly formats values with string.format. JavaScript uses plus for string concatenation and backtick template literals for interpolation. Single and double quotes do not interpolate dollar-brace expressions.…

    Lua
    1local name = "Ada"2print("Hello, " .. name .. "!")
    JavaScript
    1const name = "Ada";2console.log(`Hello, ${name}!`);
  2. Equality and Coercion

    Lua number and string equality does not equate numeric text with a number. JavaScript strict equality likewise avoids coercion, while loose equality can coerce them. Ordinary Lua tables and JavaScript objects both compare by identity unless explicit value…

    Lua
    1print(3 == "3")2local a, b = {1}, {1}3print(a == b)
    JavaScript
    1console.log(3 === "3");
  3. Sequence Indexes and push

    Lua table sequences conventionally start at one; JavaScript arrays start at zero. Lua table.insert appends to a sequence, while JavaScript push appends and returns the new length. A JavaScript negative bracket index is a property lookup, not a count from the…

    Lua
    1local items = {2}2table.insert(items, 3)3print(#items)4print(items[1])
    JavaScript
    1const items = [2];2items.push(3);3console.log(items.length);
  4. while, break, and continue

    Lua and JavaScript while loops reevaluate a condition before each iteration. Standard Lua has no continue keyword; JavaScript continue skips the rest of the current iteration. Break exits the innermost loop in both. Update progress variables on every path…

    Lua
    1local n = 32while n > 1 do n = n - 1 end3print(n)
    JavaScript
    1let n = 3;2while (n > 1) n -= 1;3console.log(n);
  5. Functions and Return Counts

    Lua functions can return multiple results, adjusted by their receiving context. JavaScript functions return one value; use an array or object to package several results. Both ordinary function bodies need explicit return for a useful value. JavaScript omitted…

    Lua
    1local function twice(n)2    return n * 23end4print(twice(4))
    JavaScript
    1function twice(n) { return n * 2; }2console.log(twice(4));
  6. JSON Without Evaluation

    Lua has no standard built-in JSON parser; programs normally use a vetted library or a narrowly specified adapter. JavaScript has JSON.parse and JSON.stringify. Parsing data must not be replaced with evaluating source code. The Lua snippet only extracts the…

    Lua
    1local fixture = "[2,3]"2local second = fixture:match("^%[%d+,(%d+)%]$")3print(tonumber(second))
    JavaScript
    1console.log(JSON.parse("[2,3]")[1]);

Syllabus

10 chapters48 lessons1 project48 challenges99 quiz questions

Apply Your Lua Experience

2 lessons

More courses for Lua developers

Learn JavaScript from another language

Frequently asked questions

Who is JavaScript for Lua Developers for?

For people who already write Lua and want to learn JavaScript. Each lesson starts from Lua you know and shows how JavaScript does the same thing, so you skip the beginner basics.

Do I need to know JavaScript already?

No. The course starts with your first JavaScript program. You need Lua basics: variables, conditions, loops, functions and collections.

How many lessons does JavaScript for Lua Developers have?

JavaScript for Lua Developers contains 48 interactive lessons you can complete at your own pace.

What does JavaScript for Lua Developers cover?

The course is organized into chapters covering: From Lua to JavaScript, Decisions and Flow, Tables to Arrays and Maps, Iteration Pipelines, and more.

Is JavaScript for Lua 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 JavaScript for Lua Developers for free

Get started