aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/modules')
-rw-r--r--src/lua/modules/audio/je_lua_audio.cpp2
-rw-r--r--src/lua/modules/graphics/je_lua_animation.cpp15
-rw-r--r--src/lua/modules/graphics/je_lua_animator.cpp5
-rw-r--r--src/lua/modules/graphics/je_lua_bitmap.cpp2
-rw-r--r--src/lua/modules/graphics/je_lua_graphics.cpp67
-rw-r--r--src/lua/modules/graphics/je_lua_spritesheet.cpp12
-rw-r--r--src/lua/modules/graphics/je_lua_texture_font.cpp6
-rw-r--r--src/lua/modules/graphics/je_lua_ttf.cpp6
-rw-r--r--src/lua/modules/graphics/je_lua_ttf_data.cpp6
-rw-r--r--src/lua/modules/net/je_lua_net.cpp4
-rw-r--r--src/lua/modules/net/je_lua_socket.cpp6
-rw-r--r--src/lua/modules/thread/je_lua_thread.cpp2
-rw-r--r--src/lua/modules/time/je_lua_time.cpp2
-rw-r--r--src/lua/modules/time/je_lua_timer.cpp6
14 files changed, 74 insertions, 67 deletions
diff --git a/src/lua/modules/audio/je_lua_audio.cpp b/src/lua/modules/audio/je_lua_audio.cpp
index 4366cd1..2935e1a 100644
--- a/src/lua/modules/audio/je_lua_audio.cpp
+++ b/src/lua/modules/audio/je_lua_audio.cpp
@@ -97,7 +97,7 @@ namespace JinEngine
luax_pushnil(L);
return 1;
}
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Source, new Shared<Source>(L, src, Jin_Lua_Source));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Source, new Shared<Source>(src, Jin_Lua_Source));
return 1;
}
diff --git a/src/lua/modules/graphics/je_lua_animation.cpp b/src/lua/modules/graphics/je_lua_animation.cpp
index 32e2c9c..4cb513c 100644
--- a/src/lua/modules/graphics/je_lua_animation.cpp
+++ b/src/lua/modules/graphics/je_lua_animation.cpp
@@ -38,19 +38,21 @@ namespace JinEngine
// addFrame(frame)
LUA_IMPLEMENT int l_addFrame(lua_State* L)
{
- SharedAnimation shrAnimation = checkAnimation(L);
+ LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation);
+ SharedAnimation shrAnimation = luaObj->getShared<Animation>();
LuaObject* pxySprite = (LuaObject*)luax_checktype(L, 2, Jin_Lua_Sprite);
Shared<Sprite>& shrSprite = pxySprite->getShared<Sprite>();
shrAnimation->addFrame(shrSprite.getObject());
int i = shrAnimation->getFrameCount() - 1;
- shrAnimation.setDependency((int)AnimationDependency::DEP_SPRITES + i, &shrSprite);
+ luaObj->setDependency((int)AnimationDependency::DEP_SPRITES + i, &shrSprite);
return 0;
}
// addFrames(frames table)
LUA_IMPLEMENT int l_addFrames(lua_State* L)
{
- SharedAnimation shrAnimation = checkAnimation(L);
+ LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation);
+ SharedAnimation shrAnimation = luaObj->getShared<Animation>();
if (!luax_istable(L, 2))
{
luax_typerror(L, 2, "sprites table");
@@ -64,7 +66,7 @@ namespace JinEngine
Shared<Sprite>& shrSprite = pxySprite->getShared<Sprite>();
shrAnimation->addFrame(shrSprite.getObject());
int index = shrAnimation->getFrameCount() - 1;
- shrAnimation.setDependency((int)AnimationDependency::DEP_SPRITES + index, &shrSprite);
+ luaObj->setDependency((int)AnimationDependency::DEP_SPRITES + index, &shrSprite);
}
return 0;
}
@@ -87,9 +89,10 @@ namespace JinEngine
LUA_IMPLEMENT int l_getFrame(lua_State* L)
{
- SharedAnimation shrAnimation = checkAnimation(L);
+ LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation);
+ SharedAnimation shrAnimation = luaObj->getShared<Animation>();
int i = luax_checkinteger(L, 2);
- SharedBase* shrFrame = shrAnimation.getDependency((int)AnimationDependency::DEP_SPRITES + i);
+ SharedBase* shrFrame = luaObj->getDependency((int)AnimationDependency::DEP_SPRITES + i);
luax_getobject(L, shrFrame);
return 1;
}
diff --git a/src/lua/modules/graphics/je_lua_animator.cpp b/src/lua/modules/graphics/je_lua_animator.cpp
index 43a1f50..c8dd420 100644
--- a/src/lua/modules/graphics/je_lua_animator.cpp
+++ b/src/lua/modules/graphics/je_lua_animator.cpp
@@ -85,10 +85,11 @@ namespace JinEngine
LUA_IMPLEMENT int l_setAnimation(lua_State* L)
{
- SharedAnimator shrAnimator = checkAnimator(L);
+ LuaObject* luaAnimator = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animator);
+ SharedAnimator shrAnimator = luaAnimator->getShared<Animator>();
LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation);
Shared<Animation>& shrAnimation = luaObj->getShared<Animation>();
- shrAnimator.setDependency((int)AnimatorDependency::DEP_ANIMATION, &shrAnimation);
+ luaAnimator->setDependency((int)AnimatorDependency::DEP_ANIMATION, &shrAnimation);
shrAnimator->setAnimation(shrAnimation.getObject());
return 0;
}
diff --git a/src/lua/modules/graphics/je_lua_bitmap.cpp b/src/lua/modules/graphics/je_lua_bitmap.cpp
index 9b71e9b..26908e6 100644
--- a/src/lua/modules/graphics/je_lua_bitmap.cpp
+++ b/src/lua/modules/graphics/je_lua_bitmap.cpp
@@ -90,7 +90,7 @@ namespace JinEngine
SharedBitmap shared = checkBitmap(L);
Bitmap* bitmap = shared.getObject();
Bitmap* b = Bitmap::clone(bitmap);
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Bitmap, new Shared<Bitmap>(L, b, Jin_Lua_Bitmap));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Bitmap, new Shared<Bitmap>(b, Jin_Lua_Bitmap));
return 1;
}
diff --git a/src/lua/modules/graphics/je_lua_graphics.cpp b/src/lua/modules/graphics/je_lua_graphics.cpp
index 907d90e..34ef8e7 100644
--- a/src/lua/modules/graphics/je_lua_graphics.cpp
+++ b/src/lua/modules/graphics/je_lua_graphics.cpp
@@ -207,7 +207,7 @@ namespace JinEngine
return 1;
}
}
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Bitmap, new Shared<Bitmap>(L, bitmap, Jin_Lua_Bitmap));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Bitmap, new Shared<Bitmap>(bitmap, Jin_Lua_Bitmap));
return 1;
}
@@ -227,7 +227,7 @@ namespace JinEngine
const char* path = luax_checkstring(L, 1);
texture = Texture::createTexture(path);
}
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Texture, new Shared<Texture>(L, texture, Jin_Lua_Texture));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Texture, new Shared<Texture>(texture, Jin_Lua_Texture));
return 1;
}
@@ -241,7 +241,7 @@ namespace JinEngine
luax_pushnil(L);
return 1;
}
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Shader, new Shared<Shader>(L, jsl, Jin_Lua_Shader));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Shader, new Shared<Shader>(jsl, Jin_Lua_Shader));
return 1;
}
@@ -264,7 +264,7 @@ namespace JinEngine
luax_pushnil(L);
return 1;
}
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Shader, new Shared<Shader>(L, jsl, Jin_Lua_Shader));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Shader, new Shared<Shader>(jsl, Jin_Lua_Shader));
return 1;
}
@@ -273,7 +273,7 @@ namespace JinEngine
int w = luax_checknumber(L, 1);
int h = luax_checknumber(L, 2);
Canvas* cvs = Canvas::createCanvas(w, h);
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Canvas, new Shared<Canvas>(L, cvs, Jin_Lua_Canvas));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Canvas, new Shared<Canvas>(cvs, Jin_Lua_Canvas));
return 1;
}
@@ -684,7 +684,7 @@ namespace JinEngine
fs->read(path, b);
fd = TTFData::createTTFData(&b, b.size());
}
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_TTFData, new Shared<TTFData>(L, fd, Jin_Lua_TTFData));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_TTFData, new Shared<TTFData>(fd, Jin_Lua_TTFData));
return 1;
}
@@ -707,7 +707,7 @@ namespace JinEngine
unsigned length;
const char* data = luax_checklstring(L, 1, &length);
Text* text = new Text(encode, data, length);
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Text, new Shared<Text>(L, text, Jin_Lua_Text));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Text, new Shared<Text>(text, Jin_Lua_Text));
return 1;
}
@@ -718,13 +718,13 @@ namespace JinEngine
LUA_IMPLEMENT int l_newSprite(lua_State* L)
{
int n = luax_gettop(L);
- LuaObject* pxyGraphic = nullptr;
+ LuaObject* objGraphic = nullptr;
if (luax_istype(L, 1, Jin_Lua_Texture))
- pxyGraphic = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Texture);
+ objGraphic = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Texture);
else if (luax_istype(L, 1, Jin_Lua_Canvas))
- pxyGraphic = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Canvas);
- Graphic* graphic = pxyGraphic->getObject<Graphic>();
- if (pxyGraphic != nullptr)
+ objGraphic = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Canvas);
+ Graphic* graphic = objGraphic->getObject<Graphic>();
+ if (objGraphic != nullptr)
{
if (n == 3 && luax_istable(L, 2))
{
@@ -735,7 +735,7 @@ namespace JinEngine
quad.h = luax_rawgetnumberthenpop(L, 2, 4);
int o = luax_checkinteger(L, 3);
Origin origin = static_cast<Origin>(o);
- LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(L, new Sprite(graphic, quad, origin), Jin_Lua_Sprite));
+ LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, quad, origin), Jin_Lua_Sprite));
}
else if (n == 4)
{
@@ -746,19 +746,19 @@ namespace JinEngine
quad.h = luax_rawgetnumberthenpop(L, 2, 4);
int ox = luax_checkinteger(L, 3);
int oy = luax_checkinteger(L, 4);
- LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(L, new Sprite(graphic, quad, ox, oy), Jin_Lua_Sprite));
+ LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, quad, ox, oy), Jin_Lua_Sprite));
}
else if (n == 2)
{
int o = luax_checkinteger(L, 2);
Origin origin = static_cast<Origin>(o);
- LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(L, new Sprite(graphic, origin), Jin_Lua_Sprite));
+ LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, origin), Jin_Lua_Sprite));
}
else if (n == 3)
{
int ox = luax_checkinteger(L, 2);
int oy = luax_checkinteger(L, 3);
- LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(L, new Sprite(graphic, ox, oy), Jin_Lua_Sprite));
+ LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, ox, oy), Jin_Lua_Sprite));
}
else
{
@@ -772,18 +772,18 @@ namespace JinEngine
LUA_IMPLEMENT int l_newSpriteSheet(lua_State* L)
{
- LuaObject* pxyGraphic = nullptr;
+ LuaObject* objGraphic = nullptr;
if (luax_istype(L, 1, Jin_Lua_Texture))
- pxyGraphic = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Texture);
+ objGraphic = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Texture);
else if(luax_istype(L, 1, Jin_Lua_Canvas))
- pxyGraphic = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Canvas);
- if (pxyGraphic != nullptr)
+ objGraphic = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Canvas);
+ if (objGraphic != nullptr)
{
- Graphic* graphic = pxyGraphic->getObject<Graphic>();
- Shared<SpriteSheet>* shrSSheet = new Shared<SpriteSheet>(L, new SpriteSheet(graphic), Jin_Lua_SpriteSheet);
- Shared<Graphic>& shrGraphic = pxyGraphic->getShared<Graphic>();
- shrSSheet->setDependency((int)SpriteSheetDependency::DEP_GRAPHIC, &shrGraphic);
- LuaObject* pxySSheet = luax_newinstance(L, Jin_Lua_SpriteSheet, shrSSheet);
+ Graphic* graphic = objGraphic->getObject<Graphic>();
+ Shared<SpriteSheet>* shrSSheet = new Shared<SpriteSheet>(new SpriteSheet(graphic), Jin_Lua_SpriteSheet);
+ Shared<Graphic>& shrGraphic = objGraphic->getShared<Graphic>();
+ LuaObject* luaSSheet = luax_newinstance(L, Jin_Lua_SpriteSheet, shrSSheet);
+ luaSSheet->setDependency((int)SpriteSheetDependency::DEP_GRAPHIC, &shrGraphic);
return 1;
}
else
@@ -794,7 +794,8 @@ namespace JinEngine
LUA_IMPLEMENT int l_newAnimation(lua_State* L)
{
int argc = luax_gettop(L);
- Shared<Animation>* shrAnimation = new Shared<Animation>(L, new Animation(), Jin_Lua_Animation);
+ Shared<Animation>* shrAnimation = new Shared<Animation>(new Animation(), Jin_Lua_Animation);
+ LuaObject* luaAnimation = luax_newinstance(L, Jin_Lua_Animation, shrAnimation);
if (argc >= 3)
{
if (!luax_istable(L, 1))
@@ -812,12 +813,12 @@ namespace JinEngine
Shared<Sprite>& shrSprite = pxySprite->getShared<Sprite>();
(*shrAnimation)->addFrame(shrSprite.getObject());
int index = (*shrAnimation)->getFrameCount() - 1;
- (*shrAnimation).setDependency((int)AnimationDependency::DEP_SPRITES + index, &shrSprite);
+ luaAnimation->setDependency((int)AnimationDependency::DEP_SPRITES + index, &shrSprite);
}
(*shrAnimation)->setLoop(loop);
(*shrAnimation)->setSpeed(speed);
}
- LuaObject* pxyAnimation = luax_newinstance(L, Jin_Lua_Animation, shrAnimation);
+ luax_pushvalue(L, argc + 1);
return 1;
}
@@ -825,20 +826,22 @@ namespace JinEngine
LUA_IMPLEMENT int l_newAnimator(lua_State* L)
{
int argc = luax_gettop(L);
- Shared<Animator>* shrAniamtor = new Shared<Animator>(L, new Animator(), Jin_Lua_Animator);
+ Shared<Animator>* shrAniamtor = new Shared<Animator>(new Animator(), Jin_Lua_Animator);
if (argc >= 1)
{
LuaObject* pxyAnimation = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation);
Shared<Animation>& shrAnimtion = pxyAnimation->getShared<Animation>();
(*shrAniamtor)->setAnimation(shrAnimtion.getObject());
- (*shrAniamtor).setDependency((int)AnimatorDependency::DEP_ANIMATION, &shrAnimtion);
+ LuaObject* pxyAnimator = luax_newinstance(L, Jin_Lua_Animator, shrAniamtor);
+ pxyAnimator->setDependency((int)AnimatorDependency::DEP_ANIMATION, &shrAnimtion);
+ return 1;
}
LuaObject* pxyAnimator = luax_newinstance(L, Jin_Lua_Animator, shrAniamtor);
return 1;
}
/* newTextureFont(bitmap, text, color | cellw, cellh) */
- LUA_IMPLEMENT int l_newTextureFont(lua_State* L)
+ LUA_IMPLEMENT int l_newTextureFont(lua_State* L)
{
LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Bitmap);
Bitmap* bitmap = p->getObject<Bitmap>();
@@ -884,7 +887,7 @@ namespace JinEngine
// Delete temporary text.
delete text;
}
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_TextureFont, new Shared<TextureFont>(L, textureFont, Jin_Lua_TextureFont));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_TextureFont, new Shared<TextureFont>(textureFont, Jin_Lua_TextureFont));
return 1;
}
diff --git a/src/lua/modules/graphics/je_lua_spritesheet.cpp b/src/lua/modules/graphics/je_lua_spritesheet.cpp
index a2f3c04..8e336c3 100644
--- a/src/lua/modules/graphics/je_lua_spritesheet.cpp
+++ b/src/lua/modules/graphics/je_lua_spritesheet.cpp
@@ -48,9 +48,9 @@ namespace JinEngine
origin = static_cast<Origin>(o);
spr = sheet->createSprite(quad, origin);
}
- Shared<Sprite>* shrSprite = new Shared<Sprite>(L, spr, Jin_Lua_Sprite);
- shrSprite->setDependency((int)SpriteDependency::DEP_SPRITESHEET, &shrSSheet);
+ Shared<Sprite>* shrSprite = new Shared<Sprite>(spr, Jin_Lua_Sprite);
LuaObject* pxySprite = luax_newinstance(L, Jin_Lua_Sprite, shrSprite);
+ pxySprite->setDependency((int)SpriteDependency::DEP_SPRITESHEET, &shrSSheet);
return 1;
}
@@ -93,13 +93,13 @@ namespace JinEngine
return 1;
}
luax_newtable(L);
- SharedBase* shrGraphic = shrSS.getDependency((int)SpriteSheetDependency::DEP_GRAPHIC);
+ SharedBase* shrGraphic = pxySS->getDependency((int)SpriteSheetDependency::DEP_GRAPHIC);
for (int i = 0; i < sprs.size(); ++i)
{
Sprite* spr = sprs[i];
- Shared<Sprite>* shrSpr = new Shared<Sprite>(L, spr, Jin_Lua_Sprite);
- shrSpr->setDependency((int)SpriteDependency::DEP_GRAPHIC, shrGraphic);
- LuaObject* pxys = (LuaObject*)luax_newinstance(L, Jin_Lua_Sprite, shrSpr);
+ Shared<Sprite>* shrSpr = new Shared<Sprite>(spr, Jin_Lua_Sprite);
+ LuaObject* luaSpr = (LuaObject*)luax_newinstance(L, Jin_Lua_Sprite, shrSpr);
+ luaSpr->setDependency((int)SpriteDependency::DEP_GRAPHIC, shrGraphic);
luax_rawseti(L, -2, i + 1);
}
return 1;
diff --git a/src/lua/modules/graphics/je_lua_texture_font.cpp b/src/lua/modules/graphics/je_lua_texture_font.cpp
index eee134c..afabf18 100644
--- a/src/lua/modules/graphics/je_lua_texture_font.cpp
+++ b/src/lua/modules/graphics/je_lua_texture_font.cpp
@@ -44,9 +44,9 @@ namespace JinEngine
Text* text = p2->getObject<Text>();
page = tf->typeset(*text, lineheight, spacing);
}
- Shared<Page>* shrPage = new Shared<Page>(L, page, Jin_Lua_Page);
- shrPage->setDependency((int)PageDependency::DEP_TEXTURE_FONT, &shrTexFont);
- LuaObject* pxyPage = luax_newinstance(L, Jin_Lua_Page, shrPage);
+ Shared<Page>* shrPage = new Shared<Page>(page, Jin_Lua_Page);
+ LuaObject* luaPage = luax_newinstance(L, Jin_Lua_Page, shrPage);
+ luaPage->setDependency((int)PageDependency::DEP_TEXTURE_FONT, &shrTexFont);
return 1;
}
diff --git a/src/lua/modules/graphics/je_lua_ttf.cpp b/src/lua/modules/graphics/je_lua_ttf.cpp
index df0379e..875c132 100644
--- a/src/lua/modules/graphics/je_lua_ttf.cpp
+++ b/src/lua/modules/graphics/je_lua_ttf.cpp
@@ -44,9 +44,9 @@ namespace JinEngine
Text* text = pxyText->getObject<Text>();
page = ttf->typeset(*text, lineheight, spacing);
}
- Shared<Page>* refPage = new Shared<Page>(L, page, Jin_Lua_Page);
- refPage->setDependency((int)PageDependency::DEP_TTF, &shrTTF);
- LuaObject* pxyPage = luax_newinstance(L, Jin_Lua_Page, refPage);
+ Shared<Page>* refPage = new Shared<Page>(page, Jin_Lua_Page);
+ LuaObject* luaPage = luax_newinstance(L, Jin_Lua_Page, refPage);
+ luaPage->setDependency((int)PageDependency::DEP_TTF, &shrTTF);
return 1;
}
diff --git a/src/lua/modules/graphics/je_lua_ttf_data.cpp b/src/lua/modules/graphics/je_lua_ttf_data.cpp
index 207dde2..a4e8d2c 100644
--- a/src/lua/modules/graphics/je_lua_ttf_data.cpp
+++ b/src/lua/modules/graphics/je_lua_ttf_data.cpp
@@ -22,9 +22,9 @@ namespace JinEngine
Shared<TTFData>& shrFontData = pxyTTFData->getShared<TTFData>();
TTFData* fontData = shrFontData.getObject();
TTF* font = fontData->createTTF(fontsize);
- Shared<TTF>* shrTTF = new Shared<TTF>(L, font, Jin_Lua_TTF);
- shrTTF->setDependency((int)TTFDependency::DEP_TTFDATA, &shrFontData);
- LuaObject* pxyTTF = luax_newinstance(L, Jin_Lua_TTF, shrTTF);
+ Shared<TTF>* shrTTF = new Shared<TTF>(font, Jin_Lua_TTF);
+ LuaObject* luaTTF = luax_newinstance(L, Jin_Lua_TTF, shrTTF);
+ luaTTF->setDependency((int)TTFDependency::DEP_TTFDATA, &shrFontData);
return 1;
}
diff --git a/src/lua/modules/net/je_lua_net.cpp b/src/lua/modules/net/je_lua_net.cpp
index bbafa3f..76ea0fe 100644
--- a/src/lua/modules/net/je_lua_net.cpp
+++ b/src/lua/modules/net/je_lua_net.cpp
@@ -49,7 +49,7 @@ namespace Lua
}
}
Socket* socket = new Socket(info);
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Socket, new Shared<Socket>(L, socket, Jin_Lua_Socket));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Socket, new Shared<Socket>(socket, Jin_Lua_Socket));
return 1;
}
@@ -57,7 +57,7 @@ namespace Lua
{
int size = luax_checkinteger(L, 1);
Net::Buffer* buffer = new Net::Buffer(size);
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Buffer, new Shared<Buffer>(L, buffer, Jin_Lua_Buffer));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Buffer, new Shared<Buffer>(buffer, Jin_Lua_Buffer));
return 1;
}
diff --git a/src/lua/modules/net/je_lua_socket.cpp b/src/lua/modules/net/je_lua_socket.cpp
index e6c2d79..8eb4051 100644
--- a/src/lua/modules/net/je_lua_socket.cpp
+++ b/src/lua/modules/net/je_lua_socket.cpp
@@ -34,7 +34,7 @@ namespace JinEngine
{
SharedSocket socket = checkSocket(L);
Socket* client = socket->accept();
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Socket, new Shared<Socket>(L, client, Jin_Lua_Socket));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Socket, new Shared<Socket>(client, Jin_Lua_Socket));
return 1;
}
@@ -45,7 +45,7 @@ namespace JinEngine
char buffer[BUFFER_SIZE] = {0};
int size = socket->receive(buffer, BUFFER_SIZE);
Net::Buffer* netBuffer = new Net::Buffer(buffer, size);
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Buffer, new Shared<Buffer>(L, netBuffer, Jin_Lua_Buffer));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Buffer, new Shared<Buffer>(netBuffer, Jin_Lua_Buffer));
return 1;
}
@@ -58,7 +58,7 @@ namespace JinEngine
char buffer[BUFFER_SIZE];
int size = socket->receiveFrom(buffer, BUFFER_SIZE, address, port);
Net::Buffer* netBuffer = new Net::Buffer(buffer, size);
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Buffer, new Shared<Buffer>(L, netBuffer, Jin_Lua_Buffer));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Buffer, new Shared<Buffer>(netBuffer, Jin_Lua_Buffer));
return 1;
}
diff --git a/src/lua/modules/thread/je_lua_thread.cpp b/src/lua/modules/thread/je_lua_thread.cpp
index 9d5713e..eea7e24 100644
--- a/src/lua/modules/thread/je_lua_thread.cpp
+++ b/src/lua/modules/thread/je_lua_thread.cpp
@@ -215,7 +215,7 @@ namespace JinEngine
const char* name = luax_checkstring(L, 1);
const char* code = luax_checkstring(L, 2);
Thread* thread = new Thread(name, code, threadRunner);
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Thread, new Shared<Thread>(L, thread, Jin_Lua_Thread));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Thread, new Shared<Thread>(thread, Jin_Lua_Thread));
return 1;
}
diff --git a/src/lua/modules/time/je_lua_time.cpp b/src/lua/modules/time/je_lua_time.cpp
index 6dc6cb5..3da5669 100644
--- a/src/lua/modules/time/je_lua_time.cpp
+++ b/src/lua/modules/time/je_lua_time.cpp
@@ -33,7 +33,7 @@ namespace JinEngine
LUA_IMPLEMENT int l_newTimer(lua_State* L)
{
- Shared<Timer>* shrTimer = new Shared<Timer>(L, new Timer(), Jin_Lua_Timer);
+ Shared<Timer>* shrTimer = new Shared<Timer>(new Timer(), Jin_Lua_Timer);
luax_newinstance(L, Jin_Lua_Timer, shrTimer);
return 1;
}
diff --git a/src/lua/modules/time/je_lua_timer.cpp b/src/lua/modules/time/je_lua_timer.cpp
index 608665b..5516be0 100644
--- a/src/lua/modules/time/je_lua_timer.cpp
+++ b/src/lua/modules/time/je_lua_timer.cpp
@@ -44,7 +44,7 @@ namespace JinEngine
for(int i = 4; i <= n; ++i)
func->pushParam(i);
Timer::Handler* handler = shared->every(s, timerCallback, func, finishCallback);
- Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(L, handler, Jin_Lua_Handler);
+ Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler);
LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Handler, shrHandler);
return 1;
}
@@ -60,7 +60,7 @@ namespace JinEngine
for (int i = 4; i <= n; ++i)
func->pushParam(i);
Timer::Handler* handler = shared->after(s, timerCallback, func, finishCallback);
- Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(L, handler, Jin_Lua_Handler);
+ Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler);
LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Handler, shrHandler);
return 1;
}
@@ -77,7 +77,7 @@ namespace JinEngine
for (int i = 5; i <= n; ++i)
func->pushParam(i);
Timer::Handler* handler = shared->repeat(s, count, timerCallback, func, finishCallback);
- Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(L, handler, Jin_Lua_Handler);
+ Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler);
LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Handler, shrHandler);
return 1;
}