So i have been reading the “programming in lua first edition” and have been learning things on a deeper level.
When I do this:
local function unpack()
--do stuff
end
unpack()
and then this
function unpack()
-- do stuff
end
It doesn’t work and I have to make it local. The only conclusion that I came to was i wasn’t making it local to that script, therefore overwriting the global variable unpack(). However if i do x = 10 in one script, and in another i do print(x), it prints nil meaning that the global variable is only local to that script so it doesn’t make a difference if i put local or make it global. So why can’t I do this with the function scenario?