Quantcast ESOUI - View Single Post - Some LUA questions
View Single Post
03/20/19, 03:34 PM   #12
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 2,354
Sure:

Everything defined local can only be used within the area you deifned it
e.g.

Lua Code:
  1. if ... then
  2. local var ...
  3. end

var is only known inside the if!

Same for
Lua Code:
  1. for ... do
  2. local var
  3. end
loops.

Same for functions

Lua Code:
  1. function thisIsAGlobalFuncKnwonInEveryOtherAddonAndAllYourFiles(param1)
  2. end
  3.  
  4. local function thisIsALocallFuncKnwonOnlyIntheAreaWhereItIsDefined(param1)
  5. --e.g. inside a file or even inside an if .. then end, or for .. do end
  6. end

https://www.lua.org/pil/4.2.html
  Reply With Quote