What does "Fire", "Return, "Call" in lua texting mean?

Hi
Like the title say, im a newbie to this lua programming community, i dont understand what are people saying when they use Those words on the title, this makes learning lua more difficult for me.

1 Like

Return

When someone says something like, “now we’ll return [variable]”. When you assign a variable to a function it will be assigned to the value of the functions return. Functions, by default, return nil. So if you don’t, yourself, return any value, the return is automatically nil. Let’s make a function to add numbers together:

local function Add(n1, n2)
    local sum = n1 + n2
end

local mySum = Add(2,6)

If we print(mySum this will return us nil because nowhere in our function do we return, however if we return the sum variable in our function:

local function Add(n1, n2)
    local sum = n1 + n2
    return sum
end

local mySum = Add(2,6)

Now, print(mySum) will result in 8 (2+6=8)

Call & Fire

I assume you are talking about when someone says to Call or Fire a function. When you call/fire a function you are just running it, the syntax for it is functionName()

2 Likes

oh so call and fire are the same?

1 Like

Well, people use them interchangeably generally. However, fire is also used when Calling a remote event or function

2 Likes

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