Programming‎ > ‎Language‎ > ‎Lua‎ > ‎

Lua Syntax

local text = tostring(k) + tostring(v)

continue
There exist no continue statement but one can use do repeat until true with break.
for k, entity in ipairs(targets) do repeat
    if entity._name == "player" then
        break
    end

    -- Do stuff for non players only
until true end

return
Return always need to be directly before a end statement. To place a return anywhere in a function use do.

do return end


Statements
if a == b then
    ...
elseif a == c then
    ...
else
    ...
end

while a < #array do
    ...
end

repeat
    ...
until a < 100

for i=0, 10 do
    ...
end

for i=0, 10 do
    ...
end

for k,v in ipairs(array) do
    ...
end

for k,v in pairs(map) do
    ...
end





Comments