Skip to content

LuaTable.Clear() does not clear the array part #183

@CodeSmile-0000011110110111

Description

Just noticed that clear only clears the dictionary (v0.5):

    public void Clear()
    {
        dictionary.Clear();
    }

I feel this should also set all array values to Nil and/or resize the array. It's unexpected behaviour:

var table = new LuaTable();
table[1] = "Hellow?";
table.Clear();
Console.WriteLine(table[1]); // should print 'nil' or throw IndexOutOfBounds

Workaround is to clear both separately:

table.Clear();
table.GetArraySpan().Clear();

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