diff options
author | chai <chaifix@163.com> | 2018-08-18 14:29:11 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-08-18 14:29:11 +0800 |
commit | 2fb51a71e53b4fc7bd4058d3a5a6f39fa81c345a (patch) | |
tree | 973d9e020b5a230d2886c564ef3445e1b654ab2a /src/lua | |
parent | a68d5cf198a87bb3e14d03dc7347ed52134355d4 (diff) |
*update
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/audio/luaopen_audio.cpp | 3 | ||||
-rw-r--r-- | src/lua/common/Reference.hpp | 1 | ||||
-rw-r--r-- | src/lua/common/constant.h | 1 | ||||
-rw-r--r-- | src/lua/graphics/luaopen_graphics.cpp | 3 | ||||
-rw-r--r-- | src/lua/luaopen_jin.h | 4 | ||||
-rw-r--r-- | src/lua/net/luaopen_net.cpp | 6 | ||||
-rw-r--r-- | src/lua/thread/luaopen_Thread.cpp | 7 | ||||
-rw-r--r-- | src/lua/thread/luaopen_thread.cpp | 7 |
8 files changed, 12 insertions, 20 deletions
diff --git a/src/lua/audio/luaopen_audio.cpp b/src/lua/audio/luaopen_audio.cpp index e6c54c9..40bfb04 100644 --- a/src/lua/audio/luaopen_audio.cpp +++ b/src/lua/audio/luaopen_audio.cpp @@ -72,8 +72,7 @@ namespace lua fs->read(f, &b); Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_AUDIO_SOURCE, sizeof(Proxy)); Source* src = Source::createSource(b.data, b.size); - Ref<Source>* ref = new Ref<Source>(src); - proxy->bind(ref, JIN_AUDIO_SOURCE); + proxy->bind(new Ref<Source>(src), JIN_AUDIO_SOURCE); return 1; } diff --git a/src/lua/common/Reference.hpp b/src/lua/common/Reference.hpp index f330323..7647a3f 100644 --- a/src/lua/common/Reference.hpp +++ b/src/lua/common/Reference.hpp @@ -26,6 +26,7 @@ namespace lua , object(obj) { } + Reference(const Reference&); virtual ~Reference() { diff --git a/src/lua/common/constant.h b/src/lua/common/constant.h new file mode 100644 index 0000000..6f70f09 --- /dev/null +++ b/src/lua/common/constant.h @@ -0,0 +1 @@ +#pragma once diff --git a/src/lua/graphics/luaopen_graphics.cpp b/src/lua/graphics/luaopen_graphics.cpp index c30365f..4a5ccce 100644 --- a/src/lua/graphics/luaopen_graphics.cpp +++ b/src/lua/graphics/luaopen_graphics.cpp @@ -407,8 +407,7 @@ namespace lua fs->read(path, &b); font->loadb((const unsigned char*)b.data); } - Ref<Font>* ref = new Ref<Font>(font); - proxy->bind(ref, JIN_GRAPHICS_FONT); + proxy->bind(new Ref<Font>(font), JIN_GRAPHICS_FONT); return 1; } diff --git a/src/lua/luaopen_jin.h b/src/lua/luaopen_jin.h index c93b66d..9cceb9e 100644 --- a/src/lua/luaopen_jin.h +++ b/src/lua/luaopen_jin.h @@ -33,11 +33,7 @@ namespace jin namespace lua { - /** - * open jin lib and boot - */ int luaopen_jin(lua_State* L); - void boot(lua_State* L); } // jin diff --git a/src/lua/net/luaopen_net.cpp b/src/lua/net/luaopen_net.cpp index 5a9ce71..a3f7900 100644 --- a/src/lua/net/luaopen_net.cpp +++ b/src/lua/net/luaopen_net.cpp @@ -47,9 +47,8 @@ namespace lua } } Socket* socket = new Socket(info); - Ref<Socket>* ref = new Ref<Socket>(socket); Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_NETWORK_SOCKET, sizeof(Proxy)); - proxy->bind(ref, JIN_NETWORK_SOCKET); + proxy->bind(new Ref<Socket>(socket), JIN_NETWORK_SOCKET); return 1; } @@ -59,8 +58,7 @@ namespace lua int size = luax_checkinteger(L, 1); Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_NETWORK_BUFFER, sizeof(Proxy)); net::Buffer* buffer = new net::Buffer(size); - Ref<Buffer>* ref = new Ref<Buffer>(buffer); - proxy->bind(ref, JIN_NETWORK_BUFFER); + proxy->bind(new Ref<Buffer>(buffer), JIN_NETWORK_BUFFER); return 1; } diff --git a/src/lua/thread/luaopen_Thread.cpp b/src/lua/thread/luaopen_Thread.cpp index eaa263d..5d44c30 100644 --- a/src/lua/thread/luaopen_Thread.cpp +++ b/src/lua/thread/luaopen_Thread.cpp @@ -219,8 +219,7 @@ namespace lua const char* code = luax_checkstring(L, 2); Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_THREAD_THREAD, sizeof(Proxy)); Thread* thread = new Thread(name, code, threadRunner); - Ref<Thread>* ref = new Ref<Thread>(thread); - proxy->bind(ref, JIN_THREAD_THREAD); + proxy->bind(new Ref<Thread>(thread), JIN_THREAD_THREAD); return 1; } @@ -232,8 +231,8 @@ namespace lua } static const luaL_Reg f[] = { - { "Thread", l_newThread}, - { "getThread", l_getThread}, + { "Thread", l_newThread }, + { "getThread", l_getThread }, { 0, 0 } }; diff --git a/src/lua/thread/luaopen_thread.cpp b/src/lua/thread/luaopen_thread.cpp index eaa263d..5d44c30 100644 --- a/src/lua/thread/luaopen_thread.cpp +++ b/src/lua/thread/luaopen_thread.cpp @@ -219,8 +219,7 @@ namespace lua const char* code = luax_checkstring(L, 2); Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_THREAD_THREAD, sizeof(Proxy)); Thread* thread = new Thread(name, code, threadRunner); - Ref<Thread>* ref = new Ref<Thread>(thread); - proxy->bind(ref, JIN_THREAD_THREAD); + proxy->bind(new Ref<Thread>(thread), JIN_THREAD_THREAD); return 1; } @@ -232,8 +231,8 @@ namespace lua } static const luaL_Reg f[] = { - { "Thread", l_newThread}, - { "getThread", l_getThread}, + { "Thread", l_newThread }, + { "getThread", l_getThread }, { 0, 0 } }; |