Added Lua 5.3's UTF-8 module to LÖVE. Resolves issue #951.

The module must be required before use, i.e. utf8 = require("utf8").  API documentation can be found here: http://www.lua.org/manual/5.3/manual.html#6.5

Removing the last unicode character in a string (for proper backspace support in text boxes, for example) can be done using utf8.offset, e.g. text = text:sub(1, utf8.offset(text, -1) - 1).
This commit is contained in:
Alex Szpakowski
2015-01-21 16:52:56 -04:00
parent b4f2a9417a
commit e82d1dfe54
7 changed files with 392 additions and 2 deletions
+6 -2
View File
@@ -43,6 +43,9 @@
#ifdef LOVE_ENABLE_ENET
# include "libraries/enet/lua-enet.h"
#endif
#ifdef LOVE_ENABLE_LUAUTF8
# include "libraries/luautf8/lutf8lib.h"
#endif
// Scripts
#include "scripts/boot.lua.h"
@@ -228,9 +231,7 @@ int luaopen_love(lua_State * L)
// Preload module loaders.
for (int i = 0; modules[i].name != 0; i++)
{
love::luax_preload(L, modules[i].func, modules[i].name);
}
#ifdef LOVE_ENABLE_LUASOCKET
love::luasocket::__open(L);
@@ -238,6 +239,9 @@ int luaopen_love(lua_State * L)
#ifdef LOVE_ENABLE_ENET
love::luax_preload(L, luaopen_enet, "enet");
#endif
#ifdef LOVE_ENABLE_LUAUTF8
love::luax_preload(L, luaopen_luautf8, "utf8");
#endif
return 1;
}