From 0265dd7b9308251128cf5fc9c965693ab247d8b3 Mon Sep 17 00:00:00 2001 From: Vanic Date: Fri, 7 Mar 2025 17:37:27 +0000 Subject: [PATCH] Licence update. Add readme --- LICENSE | 4 ++++ README.md | 8 +++++++ init.lua | 66 ------------------------------------------------------- 3 files changed, 12 insertions(+), 66 deletions(-) create mode 100644 README.md diff --git a/LICENSE b/LICENSE index 87ef441..d4d9740 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,10 @@ BSD 3-Clause License Copyright (c) 2025, Apancore.Studio +Copyright (c) 2006-2007, Kyle Smith + +Contributors: + Alimov Stepan 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 new file mode 100644 index 0000000..ca059b4 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# UTF8 API + +Mod for luanti to support Unicode strings. + +Original repo: https://github.com/Stepets/utf8.lua/tree/master + +Commit: 17f4e009a22fb2f2e6ad316a05b2cca8e071fc3b +Date of copying: 6.03.2025 diff --git a/init.lua b/init.lua index 80b3ee9..fdd2385 100644 --- a/init.lua +++ b/init.lua @@ -1,69 +1,3 @@ --- $Id: utf8.lua 179 2009-04-03 18:10:03Z pasta $ --- --- Provides UTF-8 aware string functions implemented in pure lua: --- * utf8len(s) --- * utf8sub(s, i, j) --- * utf8reverse(s) --- * utf8char(unicode) --- * utf8unicode(s, i, j) --- * utf8gensub(s, sub_len) --- * utf8find(str, regex, init, plain) --- * utf8match(str, regex, init) --- * utf8gmatch(str, regex, all) --- * utf8gsub(str, regex, repl, limit) --- --- All functions behave as their non UTF-8 aware counterparts with the exception --- that UTF-8 characters are used instead of bytes for all units. - ---[[ -Copyright (c) 2006-2007, Kyle Smith -All rights reserved. - -Contributors: - Alimov Stepan - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the author nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---]] - --- ABNF from RFC 3629 --- --- UTF8-octets = *( UTF8-char ) --- UTF8-char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4 --- UTF8-1 = %x00-7F --- UTF8-2 = %xC2-DF UTF8-tail --- UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / --- %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail ) --- UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / --- %xF4 %x80-8F 2( UTF8-tail ) --- UTF8-tail = %x80-BF --- - --- Original repo: https://github.com/Stepets/utf8.lua/tree/master --- Commit: 17f4e009a22fb2f2e6ad316a05b2cca8e071fc3b --- Date of copying: 6.03.2025 --- Code edited: VanicGame (https://github.com/VanicGame) - string_utf8 = {} dofile(core.get_modpath(core.get_current_modname()).."/utf8data.lua")