[DiscordArchive] I'll give exact error in a sec. Doesn't lua have closures though?
[DiscordArchive] I'll give exact error in a sec. Doesn't lua have closures though?
Archived author: Qux • Posted: 2023-05-26T09:31:48.195000+00:00
Original source
I'll give exact error in a sec. Doesn't lua have closures though?
Archived author: Roboto • Posted: 2023-05-26T09:31:57.049000+00:00
Original source
```lua
function f(event, player)
local guid = player:GetGUID()
CharDBQueryAsync(qrystr, function(Q)
player = GetPlayerByGUID(guid)
end)
end
```
Archived author: Roboto • Posted: 2023-05-26T09:35:02.796000+00:00
Original source
Lua base types can be used safely in callbacks (as in numbers, strings, etc). Most classes provided by the core are garbage collected automatically however, so you have to keep an ID to fetch the object again, like in my example
Archived author: Qux • Posted: 2023-05-26T09:39:19.959000+00:00
Original source
It says: got pointer to nonexisting (invalidated) object
Archived author: Qux • Posted: 2023-05-26T09:39:48.540000+00:00
Original source
I'll try that
Archived author: Qux • Posted: 2023-05-26T09:43:57.519000+00:00
Original source
That works, ty