Lua in Game Development

Love2D Pattern

LUA
function love.load()
    player = {x = 400, y = 300, speed = 200}
end
function love.update(dt)
    if love.keyboard.isDown("right") then
        player.x = player.x + player.speed * dt
    end
end
function love.draw()
    love.graphics.rectangle("fill", player.x, player.y, 32, 32)
end

Roblox (Luau)

LUA
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        local h = char:WaitForChild("Humanoid")
        h.WalkSpeed = 24
    end)
end)

🎉 You have completed the Lua course!