Chages for Ensure; Add planned mod folders; Move utf8_api to Utf8

This commit is contained in:
2025-03-14 21:35:41 +07:00
parent b4f652807d
commit 2e62b3f15c
14 changed files with 31 additions and 7 deletions

View File

@@ -9,18 +9,34 @@ Ensure = {}
--- @param function_name string Name of the parent function for error reporting
function Ensure.argType(arg, expectedType, n, function_name)
local actualType = type(arg)
assert(actualType == expectedType, 'bad argument #%s to \'%s\' (%s expected, got %s)', tostring(n), function_name, expectedType, actualType)
assert(actualType == expectedType, string.format(
'bad argument #%s to \'%s\' (%s expected, got %s)',
tostring(n),
function_name,
expectedType,
actualType))
end
--- @param arg any The argument value to type-check
--- @param n number Argument position in function call (1-based index)
local ensureArgType = Ensure.argType
--- @param arg string The string to check
--- @param n number Argument position in function call (1-based index)
--- @param function_name string Name of the parent function for error reporting
function Ensure.stringArgNotEmpty(arg, n, function_name)
ensureArgType(arg, 'string', 1, 'Ensure.stringArgNotEmpty')
assert(#arg ~= 0, string.format('bad argument #%s to \'%s\' (string cannot be empty)', n, function_name))
end
--- @param arg any The argument value to check
--- @param n number Argument position in function call (1-based index)
--- @param function_name string Name of the parent function for error reporting
function Ensure.argNotNil(arg, n, function_name)
assert(arg ~= nil, 'bad argument #%s to \'%s\' (key cannot be nil)', n, function_name)
assert(arg ~= nil, string.format('bad argument #%s to \'%s\' (key cannot be nil)', n, function_name))
end
--- @param divider number The number to check
--- @param function_name string Name of the parent function for error reporting
function Ensure.zeroDivision(divider, function_name)
assert(divider ~= 0, 'Division by zero in \'%s\'', function_name)
assert(divider ~= 0, string.format('Division by zero in \'%s\'', function_name))
end

View File

@@ -0,0 +1 @@
name = smc__api

View File

View File

@@ -0,0 +1 @@
name = core__dynamic_recipe

View File

View File

@@ -0,0 +1 @@
name = core__item_stack_timer

0
mods/CORE/Tag/init.lua Normal file
View File

1
mods/CORE/Tag/mod.conf Normal file
View File

@@ -0,0 +1 @@
name = core__tag

View File

@@ -0,0 +1 @@
name = smc__core

View File

@@ -0,0 +1 @@
name = smc__enviroment

View File

@@ -0,0 +1 @@
name = smc__ui

1
mods/UI/modpack.conf Normal file
View File

@@ -0,0 +1 @@
name = smc__ui