lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

That's great to know as well! Thanks!

On Thu, Apr 13, 2017 at 4:28 PM Luiz Henrique de Figueiredo <> wrote:
> I'd like to add support for dealing with utf-8 text in Lua 5.1 - for
> functions such as string.gsub, string.len and etc. I'm aware 5.3 comes with
> a utf8 library but I'm not considering breaking capability for the huge
> ecosystem of code that's been developed for 5.1 for my application just yet.
> I know there's starwing/luautf8, are there any other options that I should
> be considering?

With the simple changes below, lutf8lib.c from 5.3 compiles fine in 5.1.
I haven't tested it though.

    < #include "lprefix.h"
    < LUAMOD_API int luaopen_utf8 (lua_State *L) {
    <   luaL_newlib(L, funcs);
    > LUALIB_API int luaopen_utf8 (lua_State *L) {
    >   luaL_register(L, "utf8", funcs);