Structures to hold data?

Is there a Structure data type in Roblox that allows us to hold data like in C++?

For example, this is something you would do in C++:

    struct account
    {
        string name;
        double money;
    };

    int main() {
        account player1 = new account();
        player1.name = "Bob";
        player1.money = 200;
    }

1 Like

No not in Lua by default unfortunately.

1 Like

I regularly use tables in place of c++ structs.

For example,

local account = {}

account.Name = "Bob"
account.Money = 200

print(account.Name) --> Outputs Bob
2 Likes

Ah. So I would have to keep track of it in two separate arrays? :frowning:

1 Like

Yeah but I’ve heard of some people doing a work around to mimic this though I’m not familiar with it so you can try searching around the Forum for it (sorry I don’t have a link right now).

I guess this will have to do for now.

1 Like