GetWorld parameter mismatch
#3
"cRoot" by itself is a class name, not an actual object. You wouldn't expect to write "cPlayer" and the server to magically know which one player you mean Smile
This class has a (static) method "Get()" that returns the one instance of the object that the server is using. So if you want a cRoot object, you need to call "cRoot:Get()"
Finally, on this object you call its (non-static) method "GetWorld()".

I know, it is needlessly complicated, we could have made the GetWorld() function static as well (same with most of the cRoot functions, they would just operate on the single cRoot instance ever created in the server). Historical reasons.

What is even more unfortunate is the error message produced by ToLua. It is very confusing, and whoever wrote it should be ashamed of themselves. Unfortunately it's part of ToLua and as such is quite difficult to change to anything more reasonable.

One thing you might want to remember from this: When you write "Object:Function(Param)" in Lua, it actually means "Object.Function(Object, Param)" (the Object is passed as a hidden first parameter to the function), that's why ToLua is complaining about the first parameter - it is not the world's name, it's the cRoot.

A final thought, you may want to write your code in English, you never know when you're gonna opensource it or when you need help from outside Smile

--
I edited the title of your post to be more descriptive of the thread contents.
Reply
Thanks given by:


Messages In This Thread
GetWorld parameter mismatch - by heroldini - 10-26-2015, 07:41 PM
RE: heroldinis beginner questions^^ - by xoft - 10-26-2015, 09:18 PM
RE: GetWorld parameter mismatch - by worktycho - 10-27-2015, 01:28 AM
RE: GetWorld parameter mismatch - by DrMasik - 10-27-2015, 08:06 AM
RE: GetWorld parameter mismatch - by xoft - 10-27-2015, 08:04 PM



Users browsing this thread: 1 Guest(s)