VC:MP 0.4 (Beta) > Resolved Bug Reports

[WONTFIX] Player instance isn't pointing to the same thing when player leaves

(1/1)

S.L.C:
Description
I'm trying to use the player instance as the key inside a table, but when the player leaves the server the player instance isn't pointing to the same thing it was previously pointing in the table.

Reproducible
Always

What you were doing when the bug happened
N/A

What you think caused the bug
I'm not sure if this is a feature of the module and not a bug. If this is not expected behavior then I'll look for a bug.

Code that can reproduce the issue that I'm having:

--- Code: ---local t_Players = {}

function onPlayerJoin(i_player)
{     
t_Players[i_player] <- null;

print("OnJoin slot search result: " + t_Players.rawin(i_player).tostring());
}

function onPlayerPart(i_player, reason)
{
print("OnPart slot search result: " + t_Players.rawin(i_player).tostring());
}

--- End code ---

Screenshot of the console output:

stormeus:
While this is not expected behavior per se, it is also not expected that the Squirrel VM will give you the exact instance every time you request it. It's for this reason that you absolutely must do player comparisons and indexing by player ID, and not an object instance verbatim.

Won't fix.

S.L.C:
Ok. Thanks for the confirmation. I will review my code to comply with this limitation.

Navigation

[0] Message Index

Go to full version