NLua: remove this[string field] overloads on LuaTable and LuaUserData

- closes #4387

Those overloads try to imitate lua's "a.b" parsing by navigating tables recursively, e.g. `table["a.b"]` == `table.a.b`. This is not what's intended by 100% of the use cases of these overloads, so I've removed them.
This commit is contained in:
Morilli 2025-07-07 18:25:16 +02:00
parent b01ae4b757
commit f6c027f10e
4 changed files with 10 additions and 8 deletions

View File

@ -890,6 +890,7 @@ namespace NLua
return obj;
}
#if false
/// <summary>
/// Gets a field of the table or userdata corresponding to the provided reference
/// </summary>
@ -901,9 +902,10 @@ namespace NLua
State.SetTop(oldTop);
return returnValue;
}
#endif
/// <summary>
/// Gets a numeric field of the table or userdata corresponding to the provided reference
/// Gets a field of the table or userdata corresponding to the provided reference
/// </summary>
internal object GetObject(int reference, object field)
{
@ -916,6 +918,7 @@ namespace NLua
return returnValue;
}
#if false
/// <summary>
/// Sets a field of the table or userdata corresponding to the provided reference
/// to the provided value
@ -927,9 +930,10 @@ namespace NLua
SetObject(FullPathToArray(field), val);
State.SetTop(oldTop);
}
#endif
/// <summary>
/// Sets a numeric field of the table or userdata corresponding to the provided reference
/// Sets a field of the table or userdata corresponding to the provided reference
/// to the provided value
/// </summary>
internal void SetObject(int reference, object field, object val)

View File

@ -25,6 +25,7 @@ namespace NLua
{
}
#if false
/// <summary>
/// Indexer for string fields of the table
/// </summary>
@ -41,10 +42,8 @@ namespace NLua
lua.SetObject(_Reference, field, value);
}
}
#endif
/// <summary>
/// Indexer for numeric fields of the table
/// </summary>
public object this[object field]
{
get => !TryGet(out var lua) ? null : lua.GetObject(_Reference, field);

View File

@ -10,6 +10,7 @@ namespace NLua
{
}
#if false
/// <summary>
/// Indexer for string fields of the userdata
/// </summary>
@ -26,10 +27,8 @@ namespace NLua
lua.SetObject(_Reference, field, value);
}
}
#endif
/// <summary>
/// Indexer for numeric fields of the userdata
/// </summary>
public object this[object field]
{
get => !TryGet(out var lua) ? null : lua.GetObject(_Reference, field);

Binary file not shown.