Objects in List Properties are Incorrectly Exported As Integers to Lua
- Dominant language
- C++
- Stars
- 12.9k
- Forks
- 2k
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 8
Description
### Describe the bug
When adding an "object" inside a "list" property, the object with id `n` is incorrectly exported as `n`, instead of `{ id = n }`.
### Steps to reproduce
create a new map and object layer
create two objects, which get the ids `1` and `2`
add the following properties to `object 1`:
`object.obj`: an "object" property, pointing to `object 2`
`object.int`: an "int" property, set to `2`
`object.list`: a "list" property
`object.list[0]`: an "object" property, pointing to `object 2`
`object.list[1]`: an `int` property, set to `2`
This map exports with the following object layer to lua:
```lua
objects = {
{
id = 1,
name = "",
type = "",
shape = "rectangle",
x = 1.11836,
y = 2.33686,
width = 5.39148,
height = 3.22153,
rotation = 0,
opacity = 1,
visible = true,
properties = {
["list"] = {
2,
2
},
["obj"] = { id = 2 },
["int"] = 2
}
},
```
`object.obj` is exported as `{ id = 2 }`, but `object.list[0]`, which is an "object" property pointing to the same object, is exported as `2`, not `{ id = 2 }`. Because the object inside the list is exported as an integer, there is no way to distinguish an object with id `n` inside a list and the integer `n` inside a list.
### Expected Behavior
The map should export as:
```lua
objects = {
{
id = 1,
...
properties = {
["list"] = {
{ id = 2 },
2
},
["obj"] = { id = 2 },
["int"] = 2
}
},
...
```
### OS version
Windows 11
### Tiled version
1.12.2
Contributor guide
Research direction
No source file or test is named. Reproduce the issue with the described map and trace the Lua export path for object and list properties; done means object references inside lists export as `{ id = n }` while integer entries remain integers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, lua
- Domain
- content, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100