Uknown Command
#15
(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.
Reply
Thanks given by:


Messages In This Thread
Uknown Command - by Shadowraix - 05-10-2015, 12:10 PM
RE: Uknown Command - by xoft - 05-10-2015, 03:51 PM
RE: Uknown Command - by Shadowraix - 05-10-2015, 04:15 PM
RE: Uknown Command - by xoft - 05-10-2015, 04:22 PM
RE: Uknown Command - by Shadowraix - 05-11-2015, 04:56 AM
RE: Uknown Command - by worktycho - 05-11-2015, 05:32 AM
RE: Uknown Command - by xoft - 05-11-2015, 07:28 AM
RE: Uknown Command - by Shadowraix - 05-11-2015, 09:42 AM
RE: Uknown Command - by xoft - 05-11-2015, 04:45 PM
RE: Uknown Command - by Shadowraix - 05-12-2015, 06:49 AM
RE: Uknown Command - by xoft - 05-12-2015, 07:02 AM
RE: Uknown Command - by Shadowraix - 05-12-2015, 07:07 AM
RE: Uknown Command - by xoft - 05-12-2015, 07:22 AM
RE: Uknown Command - by Shadowraix - 05-12-2015, 07:27 AM
RE: Uknown Command - by xoft - 05-12-2015, 07:24 AM



Users browsing this thread: 1 Guest(s)