Imported some of the dynamiccore branch from love-experiments:

- Type names for love's Lua objects are specified as an argument to luax_register_type, rather than being statically defined in an array.

- luax_register_type takes a variable number of method array arguments, for registering superclass methods without copying them into the subclass' method array.

Also removed most of the header declarations for wrapper functions.
This commit is contained in:
Alex Szpakowski
2015-11-29 20:38:12 -04:00
parent 77998c707d
commit 2c4e713114
124 changed files with 251 additions and 1300 deletions
+3 -2
View File
@@ -144,7 +144,8 @@ int w_Channel_performAtomic(lua_State *L)
return lua_gettop(L) - 1;
}
static const luaL_Reg type_functions[] = {
static const luaL_Reg w_Channel_functions[] =
{
{ "push", w_Channel_push },
{ "supply", w_Channel_supply },
{ "pop", w_Channel_pop },
@@ -158,7 +159,7 @@ static const luaL_Reg type_functions[] = {
extern "C" int luaopen_channel(lua_State *L)
{
return luax_register_type(L, THREAD_CHANNEL_ID, type_functions);
return luax_register_type(L, THREAD_CHANNEL_ID, "Channel", w_Channel_functions, nullptr);
}
} // thread
+2 -9
View File
@@ -28,17 +28,10 @@ namespace love
{
namespace thread
{
Channel *luax_checkchannel(lua_State *L, int idx);
int w_Channel_push(lua_State *L);
int w_Channel_supply(lua_State *L);
int w_Channel_pop(lua_State *L);
int w_Channel_demand(lua_State *L);
int w_Channel_peek(lua_State *L);
int w_Channel_getCount(lua_State *L);
int w_Channel_clear(lua_State *L);
int w_Channel_performAtomic(lua_State *L);
Channel *luax_checkchannel(lua_State *L, int idx);
extern "C" int luaopen_channel(lua_State *L);
} // thread
} // love
+3 -2
View File
@@ -81,7 +81,8 @@ int w_Thread_isRunning(lua_State *L)
return 1;
}
static const luaL_Reg type_functions[] = {
static const luaL_Reg w_Thread_functions[] =
{
{ "start", w_Thread_start },
{ "wait", w_Thread_wait },
{ "getError", w_Thread_getError },
@@ -91,7 +92,7 @@ static const luaL_Reg type_functions[] = {
extern "C" int luaopen_thread(lua_State *L)
{
return luax_register_type(L, THREAD_THREAD_ID, type_functions);
return luax_register_type(L, THREAD_THREAD_ID, "Thread", w_Thread_functions, nullptr);
}
} // thread
-5
View File
@@ -30,11 +30,6 @@ namespace thread
{
LuaThread *luax_checkthread(lua_State *L, int idx);
int w_Thread_start(lua_State *L);
int w_Thread_wait(lua_State *L);
int w_Thread_getError(lua_State *L);
int w_Thread_isRunning(lua_State *L);
extern "C" int luaopen_thread(lua_State *L);
} // thread
+2 -1
View File
@@ -99,7 +99,8 @@ int w_getChannel(lua_State *L)
}
// List of functions to wrap.
static const luaL_Reg module_functions[] = {
static const luaL_Reg module_functions[] =
{
{ "newThread", w_newThread },
{ "newChannel", w_newChannel },
{ "getChannel", w_getChannel },
-3
View File
@@ -29,9 +29,6 @@ namespace love
{
namespace thread
{
int w_newThread(lua_State *L);
int w_newChannel(lua_State *L);
int w_getChannel(lua_State *L);
extern "C" LOVE_EXPORT int luaopen_love_thread(lua_State * L);