Anaminus / rbxmk

A tool for processing Roblox files.
MIT License
109 stars 11 forks source link

Cannot delete attribute with SetAttribute #57

Closed AsyxRoblox closed 2 years ago

AsyxRoblox commented 2 years ago

I encountered few strange cases/potential bugs when dealing with setting/deleting attributes and I'm not sure if I'm using them incorrectly if there is a bug.

It says in the docs that calling SetAttribute with nil should delete it, but it doesn't work.

Issue 1: Cannot set a nil attribute using SetAttribute Instance[sym.Desc] = rbxmk.globalDesc Instance[sym.RawAttrConfig] = AttrConfig.new("MyCustomProperty") -- I'm using my custom build system so I don't want to use robloxes default attribute property -- doesn't work, errors with: Error: encode attributes to "MyCustomProperty": cannot encode nil Instance:SetAttribute("hello", nil)

Issue 2: SetAttributes has a strange API: Instance[sym.Desc] = rbxmk.globalDesc -- Isn't in this case "myAttributeName" reduntant since the function should have only one argument for the dictionary? Instance:SetAttributes("myAttributeName", {bla="123"})

-- you could also execute this without error: Instance:SetAttributes(nil, {bla="123"})

Anaminus commented 2 years ago

The first issue was fixed by 23e995673c1e4913ecd7a6255e869db2f3a42d36, the second issue was fixed by 4e9d3b1f16b82c1026621b8f5c90bf3308e229c7. Thank you for your report. :)