Skip to content

Latest commit

 

History

History
39 lines (13 loc) · 484 Bytes

Functions in Lua.md

File metadata and controls

39 lines (13 loc) · 484 Bytes

Functions in Lua

Functions in Lua are defined using the function keyword. Here's an example:

function add(x, y)

return x + y

end

local result = add(10, 20)

print(result)

Lua functions can also return multiple values. Here's an example:

function square_and_cube(x)

return x^2, x^3

end

local square, cube = square_and_cube(3)

print(square, cube)l