[DiscordArchive] So does `GetData("i_dont_exist")` return `nil`, `{}` or something else?
[DiscordArchive] So does `GetData("i_dont_exist")` return `nil`, `{}` or something else?
Archived author: Michael Crilly • Posted: 2024-05-13T12:14:19.379000+00:00
Original source
So does `GetData("i_dont_exist")` return `nil`, `{}` or something else?
Archived author: Foe • Posted: 2024-05-13T12:15:11.446000+00:00
Original source
nil
Archived author: Foe • Posted: 2024-05-13T12:15:47.522000+00:00
Original source
actually no, it returns an empty table
Archived author: Michael Crilly • Posted: 2024-05-13T12:15:59.778000+00:00
Original source
Yes I thought as much.
Archived author: Michael Crilly • Posted: 2024-05-13T12:16:24.056000+00:00
Original source
So I'll have to check for that and set it to, in this case, `1` as I want to track a number?
Archived author: Foe • Posted: 2024-05-13T12:17:03.157000+00:00
Original source
just check the size of the table
Archived author: Foe • Posted: 2024-05-13T12:17:24.973000+00:00
Original source
local t = obj:GetData("key")
if #t > 0 then
Archived author: Michael Crilly • Posted: 2024-05-13T12:17:49.037000+00:00
Original source
I have a quest that requires the player to "collect" cats in the world. When the player clicks on one, I need to track if they've collected `5` cats. I was going to use `player:GetData("quest_40000_cats_collected")` as a way of checking if they've hit `5` cats and is so, set the status of a quest to complete.
Archived author: Foe • Posted: 2024-05-13T12:18:35.028000+00:00
Original source
that'll break if they log out in the middle of the quest, you should use quest counters instead
Archived author: Foe • Posted: 2024-05-13T12:18:42.233000+00:00
Original source
that way its persistent