britzl / gooey

Defold GUI system
MIT License
150 stars 22 forks source link

Added node_id to component properties. #71

Closed whiteboxdev closed 2 years ago

whiteboxdev commented 2 years ago

It would be useful to get the node_id in the widget callback functions. This way, data from tables can be easily retrieved when the table's key is the node_id.

Example:

local apple_hash = hash("apple_hash")
local banana_hash = hash("banana_hash")

local table = { [apple_hash] = { color: "red" }, [banana_hash] = { color: "yellow" } }

local function button_callback(button)
    print("My color is: " .. table[button.node_id])
end