Knit for Plugins: Is it possible, and is it a good idea?

  1. What do you want to achieve? I want to use the Knit framework to manage my widget plugin that is created with a frame inside of the folder.

  2. What is the issue? My Knit controller is not printing.

  3. What solutions have you tried so far? I’ve tried searching for this, and haven’t found anything. This may be a bad idea for a plugin anyway who knows

`KnitRuntime.client.lua` inside of Plugin folder
--Folders
local controllersFolder = script.Parent:WaitForChild("Controllers")

--Modules
local Knit = require(script.Parent.Packages.Knit)

Knit.AddControllers(controllersFolder)
Knit.AddControllersDeep(controllersFolder)

Knit.Start()
`testcontroller.lua` in Plugin/Controllers folder
--[=[
    @class testcontroller
    
    ### ⏲Release Version:
    0.0.1-alpha
    ### 📃Description:
    test

]=]

--Roblox Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--Modules
local Packages = ReplicatedStorage.Packages
local Knit = require(Packages.Knit)

local testcontroller = Knit.CreateController { Name = "testcontroller" }

--[=[
@within testcontroller
@method KnitStart
@since 0.0.1-alpha
Knit will call KnitStart after all services have been initialized

]=]
function testcontroller:KnitStart()
    
end

--[=[
@within testcontroller
@method KnitInit
@since 0.0.1-alpha
Knit will call KnitInit when Knit is first started

]=]
function testcontroller:KnitInit()
    print("Knit is running!!!")
end


return testcontroller
1 Like

From my experience, Knit isn’t really good with anything other than game frameworks.
If you really want to over-engineer a plugin to it’s fullest extent try: Roact.

It’s the ROBLOX version of React to create more inclusive GUIs, However it comes along with some learning… documentation

If you like the whole promise system Knit provides you can just simply use promises

Offical DevForum post: Roact: The Ultimate UI Framework

And if your really serious, Pair Rodux and Roact for state management and hardcore UI Support.

1 Like