View Single Post
04-28-23, 11:06 AM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,894
Your OnLoad function was global so it can be called pretty much anywhere. The only proviso being that the file containing the function has to be loaded before the function is used (same goes for within in the same .lua file, a function (variable etc.) must be defined before it is used.)
Lua Code:
  1. MyFunction() -- error
  2. function MyFunction()
  3.     print("This is MY function!")
  4. end

Lua Code:
  1. function MyFunction()
  2.     print("This is MY function!")
  3. end
  4. MyFunction() -- no error
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote