diff --git a/.gitmodules b/.gitmodules index 3f33201..9e865e3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "mods/API/utf8_api"] - path = mods/API/utf8_api + path = mods/API/Utf8 url = https://github.com/ApancoreStudio/utf8_api.git diff --git a/mods/API/Ensure/init.lua b/mods/API/Ensure/init.lua index e6ad95e..dc84c05 100644 --- a/mods/API/Ensure/init.lua +++ b/mods/API/Ensure/init.lua @@ -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 diff --git a/mods/API/utf8_api b/mods/API/Utf8 similarity index 100% rename from mods/API/utf8_api rename to mods/API/Utf8 diff --git a/mods/API/modpack.conf b/mods/API/modpack.conf index e69de29..966aa9d 100644 --- a/mods/API/modpack.conf +++ b/mods/API/modpack.conf @@ -0,0 +1 @@ +name = smc__api diff --git a/mods/CORE/DynamicRecipe/init.lua b/mods/CORE/DynamicRecipe/init.lua new file mode 100644 index 0000000..e69de29 diff --git a/mods/CORE/DynamicRecipe/mod.conf b/mods/CORE/DynamicRecipe/mod.conf new file mode 100644 index 0000000..d6f35c0 --- /dev/null +++ b/mods/CORE/DynamicRecipe/mod.conf @@ -0,0 +1 @@ +name = core__dynamic_recipe \ No newline at end of file diff --git a/mods/CORE/ItemStackTimer/init.lua b/mods/CORE/ItemStackTimer/init.lua new file mode 100644 index 0000000..e69de29 diff --git a/mods/CORE/ItemStackTimer/mod.conf b/mods/CORE/ItemStackTimer/mod.conf new file mode 100644 index 0000000..b1fb135 --- /dev/null +++ b/mods/CORE/ItemStackTimer/mod.conf @@ -0,0 +1 @@ +name = core__item_stack_timer \ No newline at end of file diff --git a/mods/CORE/Tag/init.lua b/mods/CORE/Tag/init.lua new file mode 100644 index 0000000..e69de29 diff --git a/mods/CORE/Tag/mod.conf b/mods/CORE/Tag/mod.conf new file mode 100644 index 0000000..7e33e4d --- /dev/null +++ b/mods/CORE/Tag/mod.conf @@ -0,0 +1 @@ +name = core__tag \ No newline at end of file diff --git a/mods/CORE/modpack.conf b/mods/CORE/modpack.conf index e69de29..27b7bcc 100644 --- a/mods/CORE/modpack.conf +++ b/mods/CORE/modpack.conf @@ -0,0 +1 @@ +name = smc__core diff --git a/mods/ENVIROMENT/modpack.conf b/mods/ENVIROMENT/modpack.conf index e69de29..38454a8 100644 --- a/mods/ENVIROMENT/modpack.conf +++ b/mods/ENVIROMENT/modpack.conf @@ -0,0 +1 @@ +name = smc__enviroment diff --git a/mods/GAME/modpack.conf b/mods/GAME/modpack.conf index e69de29..342dbf1 100644 --- a/mods/GAME/modpack.conf +++ b/mods/GAME/modpack.conf @@ -0,0 +1 @@ +name = smc__ui diff --git a/mods/UI/modpack.conf b/mods/UI/modpack.conf new file mode 100644 index 0000000..342dbf1 --- /dev/null +++ b/mods/UI/modpack.conf @@ -0,0 +1 @@ +name = smc__ui