- Fixed a container bug

- Added onDone to Program
This commit is contained in:
Robert Jelic
2025-06-20 14:19:05 +02:00
parent ea0f31fe37
commit 8067f23d42
16 changed files with 671 additions and 5 deletions

View File

@@ -0,0 +1,35 @@
local fileReader = {}
--- Read file content
--- @param filePath string Path to the file
--- @return string|nil content File content or nil if error
--- @return string|nil error Error message if any
function fileReader.readFile(filePath)
local file = io.open(filePath, "r")
if not file then
return nil, "Could not open file: " .. filePath
end
local content = file:read("*all")
file:close()
return content, nil
end
--- Write content to file
--- @param filePath string Path to the file
--- @param content string Content to write
--- @return string|nil error Error message if any
function fileReader.writeFile(filePath, content)
local file = io.open(filePath, "w")
if not file then
return "Could not open file for writing: " .. filePath
end
file:write(content)
file:close()
return nil
end
return fileReader

View File

@@ -0,0 +1,16 @@
local string_utils = require("utils.string_utils")
local utils = {}
-- Re-export string utilities
utils.trim = string_utils.trim
utils.is_empty = string_utils.is_empty
utils.starts_with = string_utils.starts_with
utils.ends_with = string_utils.ends_with
utils.split = string_utils.split
function utils.isClassMethod(name)
return name:sub(1, 1):upper() == name:sub(1, 1)
end
return utils

View File

@@ -0,0 +1,27 @@
local string_utils = {}
function string_utils.trim(s)
return s:match("^%s*(.-)%s*$")
end
function string_utils.is_empty(s)
return s == nil or s == ""
end
function string_utils.starts_with(s, prefix)
return s:sub(1, #prefix) == prefix
end
function string_utils.ends_with(s, suffix)
return s:sub(-#suffix) == suffix
end
function string_utils.split(s, delimiter)
local result = {}
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match)
end
return result
end
return string_utils