You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? I want to return a embedded function
What is the issue? Include screenshots / videos if possible! I’m unsure how to return a embedded function
What solutions have you tried so far? Look on google for help and the form and found no answers
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
function BasicMath()
function Add(a,b)
function Subtract(a,b)
function Mutiply(a,b)
function Divide(a,b)
end
end
end
end
end
Hello there! i’m trying to return a embedded function how can i do this? thanks for your help
local function hi()
local otherFunctions = {}
otherFunctions.Bye = function()
return "Bye!!"
end
return otherFunctions
end
print(hi().Bye()) -- prints "Bye!!"
If you want to chain a function then take a look at this post:
-- ModuleScript in ReplicatedStorage
local basicMaths = {}
basicMaths.Add = function(a, b)
return a + b
end
basicMaths.Subtract = function(a, b)
return a - b
end
basicMaths.Mutiply = function(a, b)
return a * b
end
basicMaths.Divide = function(a, b)
return a / b
end
return basicMaths
-- Script in ServerScriptService
local basicMaths = require(game.ReplicatedStorage.ModuleScript)
local value = basicMaths.Add(69, 420)
print(value)