Lua Function Range

I got an error if I like it. What should I do?

local function one() local function two() local function three() callMe() -- got error here end end end local function callMe() print ("can't call :(") end callMe() 
+1
source share
2 answers

locals must be declared before using:

 local callMe local function one() local function two() local function three() callMe() -- got error here end end end function callMe() print ("can't call :(") end callMe() 
+6
source

As well as the lack of () for one , two and three , as Bart Kirs said, calling three() will be an error, since callMe is a local function outside the scope of three , so it does not know this function.

+4
source

Source: https://habr.com/ru/post/1432605/


All Articles