__TS__DescriptorGet uses rawget, which ignores __index, therefore returning nil when trying to access fields or methods of base class
For example, in dota_ts_adapter:
setmetatable(BaseAbility.prototype, {
__index: CDOTA_Ability_Lua ?? C_DOTA_Ability_Lua,
});
Then, extending BaseAbility and calling method on super
class SuperAbility extends BaseAbility {
GetBehavior() {
const res = super.GetBehavior();
// ...
}
}
Produces the following lua code:
local res = __TS__DescriptorGet(self, BaseAbility.prototype, "GetBehavior")(self)
Which causes attempt to call a nil value error in runtime
__TS__DescriptorGetusesrawget, which ignores__index, therefore returningnilwhen trying to access fields or methods of base classFor example, in
dota_ts_adapter:Then, extending
BaseAbilityand calling method onsuperProduces the following lua code:
Which causes
attempt to call a nil valueerror in runtime