05-12-2015, 07:27 AM
(This post was last modified: 05-12-2015, 07:28 AM by Shadowraix.)
(05-12-2015, 07:22 AM)xoft Wrote: (Found out this is not true)It really depends. When you call those functions from the global code in the file (code not wrapped within any function), it will not work. If you call the function as a reaction to something MCServer calls (such as the Initialize() method, or the hook handlers etc.), then it will work, because at that time the globals will be fully primed.
So, for example, this WON'T work:
function cool() hi() end function hi() print("hi") end function intermediate() cool() end -- Global call, fails: intermediate()
You should not use this anyway, you should call any initialization in the Initialize() function and then react to callbacks from the server; only use global calls for trivial things, such as setting up global singletons etc.
(Use [ shcode=lua ] code [ /shcode ] in the forum to post Lua code)
I never intended to use global calls. I had planned to use the Initialize function act as a "main" function then tie my code to continue after initialize. I was just more or less curious on the process that McServer does to load these files so I can figure out what I can and can't do. I'm a VERY in depth person so you'll probably be seeing tons of more questions from me on these forums.
I plan to provide MCServer a lot of support in return though. xP
Edit: So it does work? Interesting.