From 46a20433566021da6f527d966324e557cce5283f Mon Sep 17 00:00:00 2001 From: aaron <83140718+centau@users.noreply.github.com> Date: Sat, 4 Jan 2025 00:45:55 +0000 Subject: [PATCH] Ignore `false` passed as a child --- CHANGELOG.md | 1 + src/apply.luau | 2 +- test/tests.luau | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fee931d..00f644f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). impulse. - `show()` now receives a source to its callback returning the current value of the condition. +- Ignore `false` passed as a child. ### Changed diff --git a/src/apply.luau b/src/apply.luau index 95645da..05ba98a 100644 --- a/src/apply.luau +++ b/src/apply.luau @@ -93,7 +93,7 @@ local function process_properties(properties: Map, instance: I else process_properties(value :: Map, instance, cache, depth + 1) end - else + elseif type(value) == "userdata" then (value :: Instance).Parent = instance -- parent child end end diff --git a/test/tests.luau b/test/tests.luau index d79e966..36a22b8 100644 --- a/test/tests.luau +++ b/test/tests.luau @@ -819,6 +819,20 @@ TEST("create()", wrap_root(function() CHECK(frame:FindFirstChild "G") end + do CASE "set false as child" + create "Frame" { + false + } + + create "Frame" { + function() return false end + } + + create "Frame" { + function() return { false } end + } + end + do CASE "binding properties to source" local name = source("Hi") local text = source("Bye")