c0balt60/create

Library providing sugar for declaring instances

create

Simple library made for declaring instances

Usage:

Just pass in the ClassName of the instance you want, initial properties, and children. Create will do the rest for you

local create = require(...)

create("Frame", {
    Active = true,
    BackgroundTransparency = 1,
    Size = UDim2.fromScale(1, 1),

    Children = {
        create("TextLabel", {
            BackgroundTransparency = 1,
            Text = "",

            Children = create("UIStroke", {
                Size = 1
            })
        }),
        create("ImageButton", {
            BackgroundTransparency = 1,
            Image = "",

            MouseButton1Down = function(...)
                print(...)
            end
        })
    }
})

Additional implementation:

  • Children member is reserved for passing in children of the Instance.
  • Setting an event member such as MouseButton1Down will Connect the callback to the event