Table access using scope operator not working (XML) #5

Open
opened 2025-08-31 02:03:05 +08:00 by sigmasoldi3r · 0 comments
sigmasoldi3r commented 2025-08-31 02:03:05 +08:00 (Migrated from github.com)

Hello! I was testing the example from the guide: XML in Basalt, but it does not work straight from the guide.

If you do, in your xml <elem var="${table.value}"> the engine looks up the scope variable as scope["table.value"].

This means that the example:

<frame background="${colors.gray}">
    <label 
        x="2" y="2"
        text="${appTitle}"
    />
</frame>
local scope = {
    appTitle = "My App",
    colors = colors
}

Won't work, instead you have to write:

local scope = {
    appTitle = "My App",
-   colors = colors
+   ["colors.gray"] = colors.gray
}
Hello! I was testing the example from [the guide: XML in Basalt](https://basalt.madefor.cc/guides/xml.html#example-with-multiple-features), but it does not work straight from the guide. If you do, in your xml `<elem var="${table.value}">` the engine looks up the scope variable as `scope["table.value"]`. This means that the example: ```xml <frame background="${colors.gray}"> <label x="2" y="2" text="${appTitle}" /> </frame> ``` ```lua local scope = { appTitle = "My App", colors = colors } ``` Won't work, instead you have to write: ```diff local scope = { appTitle = "My App", - colors = colors + ["colors.gray"] = colors.gray } ```
Sign in to join this conversation.
No description provided.