How to write f(x) in Lua?

I have some equations that need f(x), so I’m wondering how I would write f(x) in Lua.

function f(x)
    return x * x
end

-- usage
local result = f(5)
print(result)  -- This will print 25
function example(x, y)
	local number = x + y
	print(x + y) -- or number
end

example(3, 4) -- prints 7

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.