mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-20 17:41:37 +00:00
In the plugin, don't write properties if they're nil and also a number (#955)
This commit is contained in:
parent
844f51d916
commit
3e53d67412
3 changed files with 13 additions and 2 deletions
|
|
@ -7,7 +7,7 @@ local Log = require(Packages.Log)
|
|||
local RbxDom = require(Packages.RbxDom)
|
||||
local Error = require(script.Parent.Error)
|
||||
|
||||
local function setProperty(instance, propertyName, value)
|
||||
local function setProperty(instance: Instance, propertyName: string, value: unknown): boolean
|
||||
local descriptor = RbxDom.findCanonicalPropertyDescriptor(instance.ClassName, propertyName)
|
||||
|
||||
-- We can skip unknown properties; they're not likely reflected to Lua.
|
||||
|
|
@ -28,6 +28,13 @@ local function setProperty(instance, propertyName, value)
|
|||
})
|
||||
end
|
||||
|
||||
if value == nil then
|
||||
if descriptor.dataType == "Float32" or descriptor.dataType == "Float64" then
|
||||
Log.trace("Skipping nil {} property {}.{}", descriptor.dataType, instance.ClassName, propertyName)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local writeSuccess, err = descriptor:write(instance, value)
|
||||
|
||||
if not writeSuccess then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue