Skip to content

Lua code can set table[0], but С# can't read it #315

@Killfrra

Description

@Killfrra

Setup:

T = {}
T[0] = "something"
Callback(T)
static void Callback(Table table)
{
    foreach(var pair in table.Pairs)
    {
        Console.WriteLine($"{pair.Key} {pair.Value.UserData.Object}");
    }
    DynValue dynObj = table.Get(0);
    Console.WriteLine(dynObj);
}

Result:

0 something
nil

The problem is somewhere here in Table.cs

if (key.Type == DataType.Number)
{
    int idx = GetIntegralKey(key.Number);

    if (idx > 0)
    {
        Set(idx, value);
        return;
    }
}

Set is not called

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions