Ver código fonte

Update dlc.js

Lutz Roeder 2 anos atrás
pai
commit
ebde414bb2
1 arquivos alterados com 7 adições e 3 exclusões
  1. 7 3
      source/dlc.js

+ 7 - 3
source/dlc.js

@@ -321,12 +321,16 @@ dlc.Container = class {
                                 case 8: return [ 'int32[]',   Array.from(attr.int32_list)   ];
                                 case 9: return [ 'float32[]', Array.from(attr.float32_list) ];
                                 case 11: {
-                                    const list = [];
+                                    const obj = {};
+                                    let index = 0;
+                                    let list = true;
                                     for (const attribute of attr.attributes) {
                                         const entry = updateAttribute(attribute);
-                                        list.push(entry[1]);
+                                        obj[attribute.name] = entry[1];
+                                        list = list && index.toString() === attribute.name;
+                                        index++;
                                     }
-                                    return [ 'object[]', list ];
+                                    return list ? [ '', Object.values(obj) ] : [ '', obj ];
                                 }
                                 default:
                                     throw new dlc.Error("Unsupported attribute type '" + attr.type + "'.");