mirror of
https://github.com/love2d/love.git
synced 2026-08-20 12:40:20 +02:00
Make love compile against lua5.2
This commit is contained in:
@@ -34,11 +34,14 @@ AC_CHECK_HEADER([freetype2/freetype/config/ftheader.h], [includes="$includes -I/
|
|||||||
# Lua, treated seperately because of --with-lua
|
# Lua, treated seperately because of --with-lua
|
||||||
AC_ARG_WITH([lua], [AS_HELP_STRING([--with-lua], [Select the lua implementation])],
|
AC_ARG_WITH([lua], [AS_HELP_STRING([--with-lua], [Select the lua implementation])],
|
||||||
[], [with_lua=lua])
|
[], [with_lua=lua])
|
||||||
|
AC_ARG_WITH([luaversion], [AS_HELP_STRING([--with-luaversion], [Select the lua version])],
|
||||||
|
[], [with_luaversion=5.1])
|
||||||
|
|
||||||
AC_SEARCH_LIBS([lua_pcall], ["$with_lua" "${with_lua}5.1"], [],
|
AS_VAR_IF([with_luaversion], [5.2], [luatest=lua_version], [luatest=lua_pcall]) # use lua_version for 5.2
|
||||||
|
AC_SEARCH_LIBS([$luatest], ["${with_lua}${with_luaversion}" "${with_lua}"], [],
|
||||||
AC_MSG_ERROR([Can't LÖVE without $with_lua]))
|
AC_MSG_ERROR([Can't LÖVE without $with_lua]))
|
||||||
|
AC_CHECK_HEADER(["${with_lua}${with_luaversion}/lua.h"], [includes="$includes -I/usr/include/${with_lua}${with_luaversion}"], [])
|
||||||
AC_CHECK_HEADER(["${with_lua}/lua.h"], [includes="$includes -I/usr/include/${with_lua}"], [])
|
AC_CHECK_HEADER(["${with_lua}/lua.h"], [includes="$includes -I/usr/include/${with_lua}"], [])
|
||||||
AC_CHECK_HEADER(["${with_lua}5.1/lua.h"], [includes="$includes -I/usr/include/${with_lua}5.1"], [])
|
|
||||||
|
|
||||||
# mpg123, treated seperately because it can be disabled (default on)
|
# mpg123, treated seperately because it can be disabled (default on)
|
||||||
AC_ARG_ENABLE([mpg123], AC_HELP_STRING([--disable-mpg123], [Disable mp3 support, for patent-free builds]), [], [enable_mpg123=yes])
|
AC_ARG_ENABLE([mpg123], AC_HELP_STRING([--disable-mpg123], [Disable mp3 support, for patent-free builds]), [], [enable_mpg123=yes])
|
||||||
|
|||||||
@@ -486,6 +486,13 @@ int luax_getregistry(lua_State *L, Registry r)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" int luax_typerror(lua_State *L, int narg, const char *tname)
|
||||||
|
{
|
||||||
|
const char *msg = lua_pushfstring(L, "%s expected, got %s",
|
||||||
|
tname, luaL_typename(L, narg));
|
||||||
|
return luaL_argerror(L, narg, msg);
|
||||||
|
}
|
||||||
|
|
||||||
StringMap<Type, TYPE_MAX_ENUM>::Entry typeEntries[] =
|
StringMap<Type, TYPE_MAX_ENUM>::Entry typeEntries[] =
|
||||||
{
|
{
|
||||||
{"Invalid", INVALID_ID},
|
{"Invalid", INVALID_ID},
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
// Lua
|
// Lua
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#define LUA_COMPAT_ALL
|
||||||
#include <lua.h>
|
#include <lua.h>
|
||||||
#include <lualib.h>
|
#include <lualib.h>
|
||||||
#include <lauxlib.h>
|
#include <lauxlib.h>
|
||||||
@@ -346,6 +347,10 @@ int luax_insistlove(lua_State *L, const char *k);
|
|||||||
**/
|
**/
|
||||||
int luax_getregistry(lua_State *L, Registry r);
|
int luax_getregistry(lua_State *L, Registry r);
|
||||||
|
|
||||||
|
extern "C" { // Also called from luasocket
|
||||||
|
int luax_typerror(lua_State *L, int narg, const char *tname);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Like luax_totype, but causes an error if the value at idx is not Proxy,
|
* Like luax_totype, but causes an error if the value at idx is not Proxy,
|
||||||
* or is not the specified type.
|
* or is not the specified type.
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ int w_newGeometry(lua_State *L)
|
|||||||
vertex v;
|
vertex v;
|
||||||
lua_rawgeti(L, 1, i+1);
|
lua_rawgeti(L, 1, i+1);
|
||||||
if (!lua_istable(L, -1))
|
if (!lua_istable(L, -1))
|
||||||
return luaL_typerror(L, 1, "table of tables");
|
return luax_typerror(L, 1, "table of tables");
|
||||||
|
|
||||||
for (int j = 1; j <= 8; j++)
|
for (int j = 1; j <= 8; j++)
|
||||||
lua_rawgeti(L, -j, j);
|
lua_rawgeti(L, -j, j);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ static T *_getScalars(lua_State *L, int count, size_t &dimension)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete[] values;
|
delete[] values;
|
||||||
luaL_typerror(L, 3 + i, "number or boolean");
|
luax_typerror(L, 3 + i, "number or boolean");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ static T *_getVectors(lua_State *L, int count, size_t &dimension)
|
|||||||
if (!lua_istable(L, 3 + i))
|
if (!lua_istable(L, 3 + i))
|
||||||
{
|
{
|
||||||
delete[] values;
|
delete[] values;
|
||||||
luaL_typerror(L, 3 + i, "table");
|
luax_typerror(L, 3 + i, "table");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (lua_objlen(L, 3 + i) != dimension)
|
if (lua_objlen(L, 3 + i) != dimension)
|
||||||
@@ -98,7 +98,7 @@ static T *_getVectors(lua_State *L, int count, size_t &dimension)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete[] values;
|
delete[] values;
|
||||||
luaL_typerror(L, -1, "number or boolean");
|
luax_typerror(L, -1, "number or boolean");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ int w_Shader_sendInt(lua_State *L)
|
|||||||
else if (lua_istable(L, 3))
|
else if (lua_istable(L, 3))
|
||||||
values = _getVectors<int>(L, count, dimension);
|
values = _getVectors<int>(L, count, dimension);
|
||||||
else
|
else
|
||||||
return luaL_typerror(L, 3, "number, boolean, or table");
|
return luax_typerror(L, 3, "number, boolean, or table");
|
||||||
|
|
||||||
if (!values)
|
if (!values)
|
||||||
return luaL_error(L, "Error in arguments.");
|
return luaL_error(L, "Error in arguments.");
|
||||||
@@ -162,7 +162,7 @@ int w_Shader_sendFloat(lua_State *L)
|
|||||||
else if (lua_istable(L, 3))
|
else if (lua_istable(L, 3))
|
||||||
values = _getVectors<float>(L, count, dimension);
|
values = _getVectors<float>(L, count, dimension);
|
||||||
else
|
else
|
||||||
return luaL_typerror(L, 3, "number, boolean, or table");
|
return luax_typerror(L, 3, "number, boolean, or table");
|
||||||
|
|
||||||
if (!values)
|
if (!values)
|
||||||
return luaL_error(L, "Error in arguments.");
|
return luaL_error(L, "Error in arguments.");
|
||||||
@@ -189,7 +189,7 @@ int w_Shader_sendMatrix(lua_State *L)
|
|||||||
const char *name = luaL_checkstring(L, 2);
|
const char *name = luaL_checkstring(L, 2);
|
||||||
|
|
||||||
if (!lua_istable(L, 3))
|
if (!lua_istable(L, 3))
|
||||||
return luaL_typerror(L, 3, "matrix table");
|
return luax_typerror(L, 3, "matrix table");
|
||||||
|
|
||||||
lua_getfield(L, 3, "dimension");
|
lua_getfield(L, 3, "dimension");
|
||||||
int dimension = lua_tointeger(L, -1);
|
int dimension = lua_tointeger(L, -1);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ LuaThread::~LuaThread()
|
|||||||
void LuaThread::threadFunction()
|
void LuaThread::threadFunction()
|
||||||
{
|
{
|
||||||
this->retain();
|
this->retain();
|
||||||
lua_State * L = lua_open();
|
lua_State *L = luaL_newstate();
|
||||||
luaL_openlibs(L);
|
luaL_openlibs(L);
|
||||||
#ifdef LOVE_BUILD_STANDALONE
|
#ifdef LOVE_BUILD_STANDALONE
|
||||||
love::luax_preload(L, luaopen_love, "love");
|
love::luax_preload(L, luaopen_love, "love");
|
||||||
|
|||||||
Reference in New Issue
Block a user