[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Adding utf-8 handling support to Lua 5.1 in 2017
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 13 Apr 2017 11:28:27 -0300
> 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.
10d9
< #include "lprefix.h"
250,251c249,250
< 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);