Test
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
local VisualElement = require("elements/VisualElement")
|
local VisualElement = require("elements/VisualElement")
|
||||||
local tHex = require("libraries/colorHex")
|
local tHex = require("libraries/colorHex")
|
||||||
|
---@configDescription A text input field with various features
|
||||||
|
---@configDefault true
|
||||||
|
|
||||||
--- This is the input class. It provides a text input field that can handle user input with various features like
|
--- This is the input class. It provides a text input field that can handle user input with various features like
|
||||||
--- cursor movement, text manipulation, placeholder text, and input validation.
|
--- cursor movement, text manipulation, placeholder text, and input validation.
|
||||||
|
|||||||
@@ -36,24 +36,20 @@ local function parseFile(filePath)
|
|||||||
requires = {}
|
requires = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Description aus @configDescription
|
|
||||||
local description = content:match("%-%-%-@configDescription%s*(.-)%s*\n")
|
local description = content:match("%-%-%-@configDescription%s*(.-)%s*\n")
|
||||||
if description then
|
if description then
|
||||||
config.description = description
|
config.description = description
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Default aus @configDefault
|
|
||||||
local default = content:match("%-%-%-@configDefault%s*(%w+)")
|
local default = content:match("%-%-%-@configDefault%s*(%w+)")
|
||||||
if default then
|
if default then
|
||||||
config.default = default == "true"
|
config.default = default == "true"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Dependencies aus @requires
|
|
||||||
for required in content:gmatch("%-%-%-@requires%s*(%w+)") do
|
for required in content:gmatch("%-%-%-@requires%s*(%w+)") do
|
||||||
table.insert(config.requires, required)
|
table.insert(config.requires, required)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Dependencies aus @class inheritance
|
|
||||||
local className, parent = content:match("%-%-%-@class%s*([^%s:]+)%s*:%s*([^%s\n]+)")
|
local className, parent = content:match("%-%-%-@class%s*([^%s:]+)%s*:%s*([^%s\n]+)")
|
||||||
if className and parent and parent ~= "PropertySystem" then
|
if className and parent and parent ~= "PropertySystem" then
|
||||||
table.insert(config.requires, parent)
|
table.insert(config.requires, parent)
|
||||||
@@ -63,7 +59,6 @@ local function parseFile(filePath)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function categorizeFile(path)
|
local function categorizeFile(path)
|
||||||
-- Relativen Pfad verwenden
|
|
||||||
if path:match("/elements/") then
|
if path:match("/elements/") then
|
||||||
return "elements", "UI Elements"
|
return "elements", "UI Elements"
|
||||||
elseif path:match("/plugins/") then
|
elseif path:match("/plugins/") then
|
||||||
@@ -78,33 +73,23 @@ end
|
|||||||
|
|
||||||
local function scanDirectory(srcPath)
|
local function scanDirectory(srcPath)
|
||||||
local files = {}
|
local files = {}
|
||||||
local basePath = srcPath:match("^(.+)/$") or srcPath
|
|
||||||
|
|
||||||
-- Rekursive Funktion zum Scannen von Ordnern
|
|
||||||
local function scanRecursive(dir)
|
local function scanRecursive(dir)
|
||||||
local pipe = io.popen('dir "' .. dir .. '" /b')
|
local pipe = io.popen('find "' .. dir .. '" -name "*.lua"')
|
||||||
if not pipe then return end
|
if not pipe then return end
|
||||||
|
|
||||||
for entry in pipe:lines() do
|
for path in pipe:lines() do
|
||||||
local fullPath = dir .. "\\" .. entry
|
local config = parseFile(path)
|
||||||
|
if config then
|
||||||
if entry:match("%.lua$") then
|
config.name = path:match("([^/]+)%.lua$")
|
||||||
local config = parseFile(fullPath)
|
config.path = path:gsub("^" .. srcPath .. "/", "")
|
||||||
if config then
|
files[path] = config
|
||||||
config.name = entry:gsub("%.lua$", "")
|
|
||||||
-- Relativen Pfad mit Forward Slashes erstellen
|
|
||||||
config.path = fullPath:gsub("^" .. basePath .. "\\", ""):gsub("\\", "/")
|
|
||||||
files[fullPath] = config
|
|
||||||
end
|
|
||||||
elseif io.popen('dir "' .. fullPath .. '" /ad'):read("*l") then
|
|
||||||
-- Rekursiv in Unterordner gehen
|
|
||||||
scanRecursive(fullPath)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
pipe:close()
|
pipe:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
scanRecursive(basePath)
|
scanRecursive(srcPath)
|
||||||
return files
|
return files
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -112,7 +97,6 @@ local function generateConfig(srcPath)
|
|||||||
local files = scanDirectory(srcPath)
|
local files = scanDirectory(srcPath)
|
||||||
local categories = {}
|
local categories = {}
|
||||||
|
|
||||||
-- Files in Kategorien einordnen
|
|
||||||
for path, fileConfig in pairs(files) do
|
for path, fileConfig in pairs(files) do
|
||||||
local category, categoryDesc = categorizeFile(path)
|
local category, categoryDesc = categorizeFile(path)
|
||||||
if not categories[category] then
|
if not categories[category] then
|
||||||
@@ -129,7 +113,6 @@ local function generateConfig(srcPath)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Dependencies validieren
|
|
||||||
for catName, cat in pairs(categories) do
|
for catName, cat in pairs(categories) do
|
||||||
for fileName, file in pairs(cat.files) do
|
for fileName, file in pairs(cat.files) do
|
||||||
for _, req in ipairs(file.requires or {}) do
|
for _, req in ipairs(file.requires or {}) do
|
||||||
|
|||||||
Reference in New Issue
Block a user