diff --git a/.emmyrc.json b/.emmyrc.json deleted file mode 100644 index 21558f2..0000000 --- a/.emmyrc.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "completion": { - "enable": true, - "autoRequire": false, - "callSnippet": false, - "postfix": "@" - }, - "diagnostics": { - "globals": [ - "core", - "table", - "Ensure", - "string", - "string_utf8" - ], - "disable": [ - "param-type-not-match" - ] - }, - "runtime": { - "version": "Lua5.1", - "requireLikeFunction": [], - "frameworkVersions": [], - "extensions": [], - "requirePattern": [] - } -} \ No newline at end of file diff --git a/LICENSE b/LICENSE.md similarity index 94% rename from LICENSE rename to LICENSE.md index 3562594..6dba8af 100644 --- a/LICENSE +++ b/LICENSE.md @@ -1,9 +1,10 @@ BSD 3-Clause License Copyright (c) 2006-2007, Kyle Smith +Copyright (c) 2025-2026, Van (varttist), Apancore.Studio Contributors: - Alimov Stepan, Van (Apancore.Studio) + Alimov Stepan, Van (varttist) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index ca059b4..3d9470e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Maintained By: Apancore.Studio](https://img.shields.io/badge/Maintained%20By-Apancore.Studio-543c93?style=for-the-badge)](https://github.com/lord-server/lord?tab=readme-ov-file#contributors--%D1%83%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA%D0%B8) + # UTF8 API Mod for luanti to support Unicode strings. diff --git a/init.lua b/init.lua index 774ef60..ab6660c 100644 --- a/init.lua +++ b/init.lua @@ -188,7 +188,7 @@ local shift_18 = 262144 -- 2^18 ---@param str string The input string containing UTF-8 encoded characters. ---@param ibs integer The starting byte position in the string (inclusive). ---@param jbs integer The ending byte position in the string (inclusive). ----@return integer... +---@return integer?, integer? function string_utf8.unicode(str, ibs, jbs) ensureArgType(str, "string", 1, "string_utf8.unicode") ensureArgType(ibs, "number", 2, "string_utf8.unicode") @@ -253,7 +253,7 @@ end ---@param j integer The ending character index (default: i). Negative values count from the end. ---@overload fun(str: string) ---@overload fun(str: string, i: number) ----@return integer... +---@return integer?, integer? function string_utf8.byte(str, i, j) ensureArgType(str, "string", 1, "string_utf8.byte") ensureArgType(i, "number", 2, "string_utf8.byte") @@ -299,7 +299,7 @@ end ---Creates an iterator to generate UTF-8 substrings of a specified length. ---@param str string The input UTF-8 encoded string. ---@param sub_len integer? The length of each substring in characters (default: 1). ----@return fun(skip_ptr: table | nil, bs: integer | nil) +---@return fun(skip_ptr: table | nil, bs: integer | nil):(integer?, string?, integer?) function string_utf8.gensub(str, sub_len) sub_len = sub_len or 1 @@ -312,6 +312,7 @@ function string_utf8.gensub(str, sub_len) ---@param skip_ptr table ---@param bs integer + ---@return integer?, string?, integer? return function(skip_ptr, bs) bs = (bs and bs or 1) + (skip_ptr and (skip_ptr[1] or 0) or 0) @@ -457,7 +458,7 @@ end ---Creates an iterator to traverse UTF-8 encoded characters in a string. ---@param str string The input UTF-8 encoded string. ----@return fun(skip_ptr: table|nil) +---@return fun(skip_ptr: table|nil):integer?, integer?, integer? function string_utf8.codes(str) ensureArgType(str, "string", 1, "string_utf8.codes")