Zet - A good cheat sheet table highlighting some of the key syntax differences between JavaScript, Python, and Lua:

A good cheat sheet table highlighting some of the key syntax differences between JavaScript, Python, and Lua:

FeatureJavaScriptPythonLua
Variable Declarationlet x = 10;x = 10x = 10
Function Definitionfunction myFunc() {}def my_func():function my_func()
Conditionalsif (x > 0) {}if x > 0:if x > 0 then
Loopsfor (let i = 0; i < 10; i++) {}for i in range(10):for i = 1, 10 do
Arrays/Listlet arr = [1, 2, 3];arr = [1, 2, 3]arr = {1, 2, 3}
Dictionaries/Tableslet obj = {key: "value"};dict = {"key": "value"}tbl = {key = "value"}
Comments// Single line and /* Multi-line */# Single line & ''' Multi-line '''-- Single line and --[[ Multi-line ]]
String Concatenationlet str = "Hello " + "World";str = "Hello " + "World"str = "Hello " .. "World"
Error Handlingtry { /* code */ } catch (e) {}try: ... except Exception as e:status, err = pcall(function() ... end)
Boolean Valuestrue, falseTrue, Falsetrue, false
String Interpolation Syntax`Hello, ${name}!`f"Hello, {name}!"string.format("Hello, %s!", name)

#lua #python #javascript