[Lua] Lua generator fails to generate correct code for simple singly nested table
- Dominant language
- C++
- Stars
- 26.5k
- Forks
- 3.7k
- PR merge metrics
- No merged PRs in 30d
Description
The Lua generator will generate incorrect code for this schema:
``
table Customer {
name: string;
age: int;
}
table Sale {
amount: int;
customer: Customer;
}
root_type Sale;
``
It should generate:
``
Sale.AddCustomer = function(builder, customer)
builder:PrependUOffsetTRelativeSlot(1, customer, 0)
end
``
But instead it generates:
``
function Sale.AddCustomer(builder, customer)
builder:PrependStructSlot(1, customer, 0)
end
``
This will cause an error when trying to encode a sale:
"Tried to write a Struct at an Offset that is different from the current Offset of the Builder."
See this file for schema and lua test code:
[luatest.zip](https://github.com/user-attachments/files/20668904/luatest.zip)
This bug is in the current windows release and in the head of the repo, specifically this git hash:
#5822c1c8
Contributor guide
Assessment
This issue has not been assessed yet.