프로그래밍은 컴퓨터에게 단계별 지시를 내리는 것과 같습니다. 마치 친구에게 레고 집을 만드는 방법을 설명하는 것처럼, 컴퓨터가 실행할 코드를 작성합니다. Roblox Studio에서는 Lua 프로그래밍 언어를 사용하여 게임을 만들고 아이디어를 실현할 수 있습니다. Lua는 간단하면서도 강력하여 초보자에게 적합합니다.
"Hello, world!"
function sayHello()
print("Hello, world!")
end
Variables (변수)
local message = "Hello, Roblox!"
print(message)
Empty
Empty
Empty
nil | a = nil |
boolean | b = true |
number | n = 1 |
string | s = 'abc' |
table | t = {a, b, c} |
function | foo = function(x) return 2*x end |
userdata | u = some_C_struct |
thread | co = coroutine.create( function () print('hi') end ) |
Strings in Lua (Lua의 문자열)
local greeting = "Hello"
local name = "Roblox"
print(greeting .. ", " .. name)
Combining Numbers and Strings (숫자와 문자열 결합)
local age = 10
print("I am " .. age .. " years old")
Basic Arithmetic Operations (기본 산술 연산)
local x = 10
local y = 20
print(x + y)
local a = 5
local b = 3
print(a * b)
Conditions (조건문)
local number = 10
if number > 5 then
print("Number is greater than 5")
else
print("Number is 5 or less") end
Loops (반복문)
for i = 1, 5 do
print("Iteration " .. i)
end
Functions (함수)
function greet(name)
print("Hello, " .. name)
end
greet("Roblox")
greet("Game")