Jump to content

global object variable


Recommended Posts

is possible to store global var with Player class? this not work

master = GetPlayerByGUID( 2 );

function blabla()
-- master = GetPlayerByGUID( 2 ); -- with this work well of course

-- error is

calling 'Say' on bad self (Player expected, got pointer to nonexisting (invalidated) object (userdata). Check your code.)


Link to comment
Share on other sites

Well, it is not impossible, but it is not intended. The player (or creature etc) can log out or despawn and using the variable would crash or corrupt data without you noticing.

Instead you should be storing the guid of the player and each time get the player by guid and check if the return value is nil.


If you really want to bend the rules it may be possible to do .. 
which disables the safety measure for that specific object.

That would make you the first one to use it since it was implemented though I believe :D

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use