mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 22:34:56 +00:00
- Added validation scripts for Lua quality, syntax, structure, and naming conventions. - Implemented checks for metadata and component structures, ensuring compliance with defined schemas. - Introduced validation for test file structures and common test files when lua_test is a devDependency. - Updated manifest to include new Lua scripts for sorting, filtering, selection, and export functionalities. - Improved documentation in UI_TO_LUA_MIGRATION.md to reflect current progress and completed phases.
21 lines
563 B
Lua
21 lines
563 B
Lua
--- Checks if Lua file has valid syntax
|
|
---@param filepath string Path to the Lua file
|
|
---@param content string File content
|
|
---@return boolean valid Whether syntax is valid
|
|
---@return string[] errors List of syntax errors
|
|
local function validate_lua_syntax(filepath, content)
|
|
local errors = {}
|
|
|
|
-- Try to load the Lua content
|
|
local func, err = loadstring(content)
|
|
|
|
if not func then
|
|
table.insert(errors, filepath .. ": Syntax error - " .. (err or "unknown error"))
|
|
return false, errors
|
|
end
|
|
|
|
return true, errors
|
|
end
|
|
|
|
return validate_lua_syntax
|