mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-25 23:26:19 +00:00
In the plugin, don't write properties if they're nil and also a number (#955)
This commit is contained in:
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
## Unreleased Changes
|
## Unreleased Changes
|
||||||
|
|
||||||
|
* Fixed `value of type nil cannot be converted to number` warning spam in output. [#955]
|
||||||
|
|
||||||
|
[#955]: https://github.com/rojo-rbx/rojo/pull/893
|
||||||
|
|
||||||
## [7.4.2] - July 23, 2024
|
## [7.4.2] - July 23, 2024
|
||||||
* Added Never option to Confirmation ([#893])
|
* Added Never option to Confirmation ([#893])
|
||||||
* Fixed removing trailing newlines ([#903])
|
* Fixed removing trailing newlines ([#903])
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[tools]
|
[tools]
|
||||||
rojo = "rojo-rbx/rojo@7.3.0"
|
rojo = "rojo-rbx/rojo@7.4.1"
|
||||||
selene = "Kampfkarren/selene@0.26.1"
|
selene = "Kampfkarren/selene@0.26.1"
|
||||||
stylua = "JohnnyMorganz/stylua@0.18.2"
|
stylua = "JohnnyMorganz/stylua@0.18.2"
|
||||||
run-in-roblox = "rojo-rbx/run-in-roblox@0.3.0"
|
run-in-roblox = "rojo-rbx/run-in-roblox@0.3.0"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ local Log = require(Packages.Log)
|
|||||||
local RbxDom = require(Packages.RbxDom)
|
local RbxDom = require(Packages.RbxDom)
|
||||||
local Error = require(script.Parent.Error)
|
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)
|
local descriptor = RbxDom.findCanonicalPropertyDescriptor(instance.ClassName, propertyName)
|
||||||
|
|
||||||
-- We can skip unknown properties; they're not likely reflected to Lua.
|
-- We can skip unknown properties; they're not likely reflected to Lua.
|
||||||
@@ -28,6 +28,13 @@ local function setProperty(instance, propertyName, value)
|
|||||||
})
|
})
|
||||||
end
|
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)
|
local writeSuccess, err = descriptor:write(instance, value)
|
||||||
|
|
||||||
if not writeSuccess then
|
if not writeSuccess then
|
||||||
|
|||||||
Reference in New Issue
Block a user