Post-incrementing properties or array values generates invalid lua identifiers
class Test {
lastId = 0;
constructor() {
log(this.lastId++);
}
}
The generated code looks like this
log((function()
local __originalValueself.lastId0 = self.lastId;
self.lastId = (self.lastId+1);
return __originalValueself.lastId0;
end
A similar situation happens when trying to access a variable using bracket notation
let data = {value : 0};
log(data['value']++);
Generated code:
local data = {value = 0};
log((function()
local __originalValuedata["value"]0 = data["value"];
data["value"] = (data["value"]+1);
return __originalValuedata["value"]0
end
)());
Post-incrementing properties or array values generates invalid lua identifiers
The generated code looks like this
A similar situation happens when trying to access a variable using bracket notation
Generated code: