One is compat53 which should be invoked via
Code: Select all
loadrequire("compat53")
Code: Select all
utf8strings=loadrequire["utf8"]
Code: Select all
loadrequire("compat53")
Code: Select all
utf8strings=loadrequire["utf8"]
Code: Select all
if _VERSION ~= "Lua 5.3" then
loadrequire("compat53")
utf8strings=loadrequire("utf8") -- changed from ["utf8"] that did not work?
end
So no, code can't be identical unless you avoid some Lua 5.3 features, but it does provide the utf8 functionality from Lua 5.3 among other things...This is a small module that aims to make it easier to write code in a Lua-5.3-style that is compatible with Lua 5.1, Lua 5.2, and Lua 5.3. This does not make Lua 5.2 (or even Lua 5.1) entirely compatible with Lua 5.3, but it brings the API closer to that of Lua 5.3.
If your FH6 installation wholly separate from the FH7 one (which already includes utf8)?-- 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)
Code: Select all
if _VERSION ~= "Lua 5.3" then -- loadrequire for "utf8" and "compat53" libraries
-- loadrequire code snippet goes here
-- handle exporting to global scope
local function extend_table(from, to)
if from ~= to then
for k,v in pairs(from) do
if type(v) == "table" and
type(to[k]) == "table" and
v ~= to[k] then
extend_table(v, to[k])
else
to[k] = v
end
end
end
end
utf8lib = loadrequire("utf8") -- Must be before compat53 otherwise does not load due to utf8 conflict?
loadrequire("compat53")
local M = require("compat53")
extend_table( M, _G ) -- Export local M to global _G
end -- if _VERSION ~= "Lua 5.3"
Code: Select all
loadrequire("compat53")
Code: Select all
utf8strings=loadrequire("utf8")
Code: Select all
require ("compat53")
CP have only distributed one file -- utf8.luaColeValleyGirl wrote: ↑13 Jan 2021 16:12 UTF8 files are missing -- see https://github.com/Stepets/utf8.lua (also read the instructions).
On the subject of technospeak, we are talking about a technical subject; it's quite hard to avoid the correct technical terminology, and it's a model of clarity compared to some documentation, if you're experienced with lua libraries.Re utf8, the problem is NOT the module name it's the packaging! Please leave it to me.