Script - Luar

-- Check if string ends with a suffix function string_utils.ends_with(str, suffix) return #suffix == 0 or str:sub(-#suffix) == suffix end

-- 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

-- Split string by delimiter (returns table) function string_utils.split(str, delimiter) local result = {} local pattern = string.format("([^%s]+)", delimiter) for match in str:gmatch(pattern) do table.insert(result, match) end return result end script luar

debug_utils.log("Script started") debug_utils.time_function(string_utils.trim, " test ") --]]

-- ============================================ -- UTILITY SCRIPT FOR LUA (5.1+ compatible) -- Author: Generated Assistant -- Description: Reusable functions for string, table, file, and debug tasks -- ============================================ -- Check if string ends with a suffix function string_utils

-- Check if value is a number within range function validate.is_in_range(val, min, max) return type(val) == "number" and val >= min and val <= max end

local my_table = {a=1, b={c=2}} local copy = table_utils.deep_copy(my_table) t2) for k

file_utils.write_file("test.txt", "Lua rocks!") print(file_utils.read_file("test.txt"))