lua return code example

Example 1: lua print

-- print "Hello, World!

print("Hello, World!")

-- or

x = "Hello, World!"
print(x)

Example 2: lua printing

print("Your Text here")

Example 3: print script lua

print("hi")
end

Example 4: break in lua

local i = 1
    while a[i] do
      if a[i] == v then break end
      i = i + 1
    end

Example 5: how to print in lua

print("text"..v) -- "" for strings, '..' to concencate, type name of variable to print variable

Example 6: function return lua

function factorial(x)
  if x == 1 then
    return 1
  end
  return x * factorial(x-1)
end

Tags:

Lua Example