Add basic lua 5.3 support

This commit is contained in:
Bart van Strien
2015-06-16 10:25:41 +02:00
parent df1bd42dec
commit 3cb777e2b7
39 changed files with 252 additions and 187 deletions
+4 -4
View File
@@ -72,7 +72,7 @@ int w_newTrueTypeRasterizer(lua_State *L)
if (lua_type(L, 1) == LUA_TNUMBER || lua_isnone(L, 1))
{
// First argument is a number: use the default TrueType font.
int size = luaL_optint(L, 1, 12);
int size = (int) luaL_optnumber(L, 1, 12);
const char *hintstr = lua_isnoneornil(L, 2) ? nullptr : luaL_checkstring(L, 2);
if (hintstr && !TrueTypeRasterizer::getConstant(hintstr, hinting))
@@ -89,7 +89,7 @@ int w_newTrueTypeRasterizer(lua_State *L)
else
d = filesystem::luax_getfiledata(L, 1);
int size = luaL_optint(L, 2, 12);
int size = (int) luaL_optnumber(L, 2, 12);
const char *hintstr = lua_isnoneornil(L, 3) ? nullptr : luaL_checkstring(L, 3);
if (hintstr && !TrueTypeRasterizer::getConstant(hintstr, hinting))
@@ -121,7 +121,7 @@ int w_newBMFontRasterizer(lua_State *L)
if (lua_istable(L, 2))
{
for (int i = 1; i <= (int) lua_objlen(L, 2); i++)
for (int i = 1; i <= (int) luax_objlen(L, 2); i++)
{
lua_rawgeti(L, 2, i);
@@ -162,7 +162,7 @@ int w_newImageRasterizer(lua_State *L)
image::ImageData *d = luax_checktype<image::ImageData>(L, 1, IMAGE_IMAGE_DATA_ID);
std::string glyphs = luax_checkstring(L, 2);
int extraspacing = luaL_optint(L, 3, 0);
int extraspacing = (int) luaL_optnumber(L, 3, 0);
luax_catchexcept(L, [&](){ t = instance()->newImageRasterizer(d, glyphs, extraspacing); });