View Single Post
03/20/19, 03:27 PM   #11
Supportic
Join Date: Mar 2019
Posts: 24
Okay, the next question appeared

First of all I understand now that those two function calls:

Code:
uniqueAddonName.function1(param1, param2)
uniqueAddonName:function2(param1, param2)
Just differs from each other how you want to access the global namespace inside the function.

Code:
uniqueAddonName.function1(param1, param2)
  uniqueAddonName.variable1 = param1
  uniqueAddonName.variable2 = param2
end

uniqueAddonName:function2(param1, param2)
  self.variable1 = param1
  self.variable2 = param2
end
So the next thing was to understand the concept of global and local function calls.
I thought if you use a function like this:

Code:
function(param1, param2)
it can only be used in this file. And when I bind that function to a global namespace it can be used globally.

Code:
uniqueAddonName.function(param1, param2)
But either way both functions are used across files. Is there a concept of local and global functions at all?

Cheers

Last edited by Supportic : 03/20/19 at 03:29 PM.
  Reply With Quote