Script Luar Direct

-- Check if string starts with a prefix function string_utils.starts_with(str, prefix) return str:sub(1, #prefix) == prefix end

-- Check if table is non-empty function validate.non_empty_table(tbl) return type(tbl) == "table" and next(tbl) ~= nil end script luar

-- -------------------------------------------- -- 4. DATA VALIDATION -- -------------------------------------------- local validate = {} -- Check if string starts with a prefix

-- Append string to file function file_utils.append_file(filename, content) local f, err = io.open(filename, "a") if not f then return false, err end f:write(content) f:close() return true end prefix) return str:sub(1

-- Merge table t2 into t1 (overwrites t1 keys) function table_utils.merge(t1, t2) for k, v in pairs(t2) do t1[k] = v end return t1 end

-- Log with timestamp function debug_utils.log(message, level) level = level or "INFO" local timestamp = os.date("%Y-%m-%d %H:%M:%S") print(string.format("[%s] [%s] %s", timestamp, level, message)) end