Functions in Functions

I’ve been wondering for a while if you can use functions inside of functions. I tried it didn’t work if some one knows how to do it please tell me.

You can have functions inside of functions. If the functions have the same name, the outer function will run once, then the inner function will override the outer function. Not sure what you’re actually trying to do with that.

You should do it like this

function A(c)
    --this is how to define a function inside another function
    B= function(x)
        return x*3
    end --end of function
    return B(c)

Thank you for telling me! :slight_smile: