Replaced most cases of type bits and type name strings in love's Lua wrapper code with type id's.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2015-03-01 18:32:41 -04:00
parent 3830a0969c
commit 2f419c1c83
79 changed files with 601 additions and 566 deletions
+1 -1
View File
@@ -109,7 +109,7 @@ void LuaThread::onError()
return;
Proxy p;
p.flags = THREAD_THREAD_T;
p.type = THREAD_THREAD_ID;
p.object = this;
std::vector<StrongRef<Variant>> vargs = {
+2 -2
View File
@@ -40,7 +40,7 @@ void releaseVariant(Channel *c, Variant *v)
Channel *luax_checkchannel(lua_State *L, int idx)
{
return luax_checktype<Channel>(L, idx, "Channel", THREAD_CHANNEL_T);
return luax_checktype<Channel>(L, idx, THREAD_CHANNEL_ID);
}
int w_Channel_push(lua_State *L)
@@ -129,7 +129,7 @@ static const luaL_Reg type_functions[] = {
extern "C" int luaopen_channel(lua_State *L)
{
return luax_register_type(L, "Channel", type_functions);
return luax_register_type(L, THREAD_CHANNEL_ID, type_functions);
}
}
}
+2 -2
View File
@@ -27,7 +27,7 @@ namespace thread
LuaThread *luax_checkthread(lua_State *L, int idx)
{
return luax_checktype<LuaThread>(L, idx, "Thread", THREAD_THREAD_T);
return luax_checktype<LuaThread>(L, idx, THREAD_THREAD_ID);
}
int w_Thread_start(lua_State *L)
@@ -91,7 +91,7 @@ static const luaL_Reg type_functions[] = {
extern "C" int luaopen_thread(lua_State *L)
{
return luax_register_type(L, "Thread", type_functions);
return luax_register_type(L, THREAD_THREAD_ID, type_functions);
}
} // thread
+8 -8
View File
@@ -61,22 +61,22 @@ int w_newThread(lua_State *L)
else
luax_convobj(L, 1, "filesystem", "newFileData");
}
else if (luax_istype(L, 1, FILESYSTEM_FILE_T))
else if (luax_istype(L, 1, FILESYSTEM_FILE_ID))
luax_convobj(L, 1, "filesystem", "newFileData");
if (luax_istype(L, 1, FILESYSTEM_FILE_DATA_T))
if (luax_istype(L, 1, FILESYSTEM_FILE_DATA_ID))
{
love::filesystem::FileData *fdata = luax_checktype<love::filesystem::FileData>(L, 1, "FileData", FILESYSTEM_FILE_DATA_T);
love::filesystem::FileData *fdata = luax_checktype<love::filesystem::FileData>(L, 1, FILESYSTEM_FILE_DATA_ID);
name = std::string("@") + fdata->getFilename();
data = fdata;
}
else
{
data = luax_checktype<love::Data>(L, 1, "Data", DATA_T);
data = luax_checktype<love::Data>(L, 1, DATA_ID);
}
LuaThread *t = instance()->newThread(name, data);
luax_pushtype(L, "Thread", THREAD_THREAD_T, t);
luax_pushtype(L, THREAD_THREAD_ID, t);
t->release();
return 1;
}
@@ -84,7 +84,7 @@ int w_newThread(lua_State *L)
int w_newChannel(lua_State *L)
{
Channel *c = instance()->newChannel();
luax_pushtype(L, "Channel", THREAD_CHANNEL_T, c);
luax_pushtype(L, THREAD_CHANNEL_ID, c);
c->release();
return 1;
}
@@ -93,7 +93,7 @@ int w_getChannel(lua_State *L)
{
std::string name = luax_checkstring(L, 1);
Channel *c = instance()->getChannel(name);
luax_pushtype(L, "Channel", THREAD_CHANNEL_T, c);
luax_pushtype(L, THREAD_CHANNEL_ID, c);
c->release();
return 1;
}
@@ -125,7 +125,7 @@ extern "C" int luaopen_love_thread(lua_State *L)
WrappedModule w;
w.module = instance;
w.name = "thread";
w.flags = MODULE_T;
w.type = MODULE_ID;
w.functions = module_functions;
w.types = types;