Skip to content

LuaTable always initializes array to 8 items minimum #182

@CodeSmile-0000011110110111

Description

I noticed that new LuaTable(0, 0) still generates an array with 8 entries.

Is there a reason for doing this in the LuaTable ctor?

    public LuaTable(int arrayCapacity, int dictionaryCapacity)
    {
        array = new LuaValue[Math.Max(arrayCapacity, 8)];

I thought I'll report it because I'm not sure whether this is intentional because that amounts to roughly 100 bytes overhead for an empty LuaTable.

I noticed because I have a LuaTable Inspector drawer for Unity and it just happened to add eight "null" entries to the previously empty Array:

Image

For this I can easily work around it by not serializing "nil" values rather than defaulting them to 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions