Does something like this already exist or sound possible to implement?
Thanks!
--
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lua-l+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/lua-l/0a54e879-7af6-4a28-a660-f8691030e9f2n%40googlegroups.com.
Sure, let's say you want to calculate the volume of a cylinder,
which is the area of the radius times the circle (I'm just
contriving an example to make a point):
local volume = h * math.pi * r^2
If you want to reuse the circle equation just define a function
local function circlearea(r)
return math.pi * r^2
end
and you can reuse the calculation of the circle for the volume
like this:
local volume = h * circlearea(r)