Licence update. Add readme
This commit is contained in:
4
LICENSE
4
LICENSE
@@ -1,6 +1,10 @@
|
|||||||
BSD 3-Clause License
|
BSD 3-Clause License
|
||||||
|
|
||||||
Copyright (c) 2025, Apancore.Studio
|
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
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are met:
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|||||||
8
README.md
Normal file
8
README.md
Normal file
@@ -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
|
||||||
66
init.lua
66
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 = {}
|
string_utf8 = {}
|
||||||
|
|
||||||
dofile(core.get_modpath(core.get_current_modname()).."/utf8data.lua")
|
dofile(core.get_modpath(core.get_current_modname()).."/utf8data.lua")
|
||||||
|
|||||||
Reference in New Issue
Block a user