elua: fix build with luajit or lua 5.1

This commit is contained in:
Daniel Kolesa 2020-05-29 17:45:34 +02:00
parent f78d54051c
commit 6dce869a17
2 changed files with 4 additions and 4 deletions

View File

@ -53,12 +53,12 @@ Eina_Bool _elua_state_io_setup(const Elua_State *es);
#if LUA_VERSION_NUM < 502
#define elua_register(L, lib) luaL_register(L, NULL, 0)
#define elua_rawlen(L, i) lua_rawlen(L, i)
#define elua_strlen(L, i) lua_strlen(L, i)
#else
#define elua_register(L, lib) luaL_setfuncs(L, lib, 0)
#define elua_rawlen(L, i) lua_rawlen(L, i)
#define elua_strlen(L, i) lua_rawlen(L, i)
#endif

View File

@ -167,7 +167,7 @@ read_line(lua_State *L, FILE *f)
if (fgets(p, LUAL_BUFFERSIZE, f) == NULL)
{
luaL_pushresult(&b);
return (elua_rawlen(L, -1) > 0);
return (elua_strlen(L, -1) > 0);
}
l = strlen(p);
if (!l || p[l - 1] != '\n')
@ -198,7 +198,7 @@ read_chars(lua_State *L, FILE *f, size_t n)
n -= nr;
} while (n > 0 && nr == rlen);
luaL_pushresult(&b);
return (n == 0 || elua_rawlen(L, -1) > 0);
return (n == 0 || elua_strlen(L, -1) > 0);
}
static int