Skip to content

Commit 3417019

Browse files
committed
定版2.3.0
1 parent cb43ed8 commit 3417019

File tree

17 files changed

+102
-59
lines changed

17 files changed

+102
-59
lines changed

LuaScriptCore.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "LuaScriptCore"
19-
s.version = "2.2.1"
19+
s.version = "2.3.0"
2020
s.summary = "An easy-to-use OC-Lua bridge"
2121

2222
# This description is used to generate tags and improve search results.

Sample/Android/app/app.iml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,8 @@
9999
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
100100
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-apk" />
101101
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
102-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
103102
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
104103
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
105-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
106104
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
107105
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
108106
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package cn.vimfung.luascriptcore.sample;
2+
3+
import android.util.Log;
4+
5+
public class ErrLogModule extends LogModule
6+
{
7+
8+
}

Sample/Android/app/src/main/java/cn/vimfung/luascriptcore/sample/LogModule.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.util.Log;
44

5+
import cn.vimfung.luascriptcore.LuaExclude;
56
import cn.vimfung.luascriptcore.LuaExportType;
67
import cn.vimfung.luascriptcore.LuaTuple;
78

Sample/Android/app/src/main/java/cn/vimfung/luascriptcore/sample/MainActivity.java

Lines changed: 65 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.io.IOException;
1818
import java.io.InputStream;
1919
import java.lang.ref.WeakReference;
20+
import java.lang.reflect.Array;
2021
import java.util.ArrayDeque;
2122
import java.util.ArrayList;
2223
import java.util.HashMap;
@@ -68,60 +69,78 @@ public void onException(String message) {
6869
@Override
6970
public void onClick(View v) {
7071

71-
LuaValue retValue = _luaContext.evalScript("print(10);return 'Hello World';");
72-
Log.v("lsc", retValue.toString());
73-
74-
//List Native -> Lua
75-
ArrayList<String> arrayList = new ArrayList<String>();
76-
arrayList.add("hahahahahah");
77-
arrayList.add("Hello World");
78-
LuaValue value = new LuaValue(arrayList);
79-
80-
_luaContext.evalScript("function printArray (arr) print('--------', #arr); for i,v in ipairs(arr) do print(v); end end");
81-
82-
LuaValue[] args = new LuaValue[] {value};
83-
_luaContext.callMethod("printArray", args);
84-
85-
//List Lua -> Native
86-
LuaValue arrValue = _luaContext.evalScript("return {1, 'Hello World'};");
87-
Log.v("lsc", arrValue.toString());
88-
ArrayList arrayList1 = arrValue.toArrayList();
89-
for (Object obj : arrayList1)
90-
{
91-
Log.v("LTN ArrayList", obj.toString());
92-
}
93-
List<?> list = arrValue.toList();
94-
for (Object obj : list)
95-
{
96-
Log.v("LTN List", obj.toString());
97-
}
98-
72+
// LuaValue retValue = _luaContext.evalScript("print(10);return 'Hello World';");
73+
// Log.v("lsc", retValue.toString());
74+
//
75+
// //List Native -> Lua
76+
// ArrayList<String> arrayList = new ArrayList<String>();
77+
// arrayList.add("hahahahahah");
78+
// arrayList.add("Hello World");
79+
// LuaValue value = new LuaValue(arrayList);
80+
//
81+
// _luaContext.evalScript("function printArray (arr) print('--------', #arr); for i,v in ipairs(arr) do print(v); end end");
82+
//
83+
// LuaValue[] args = new LuaValue[] {value};
84+
// _luaContext.callMethod("printArray", args);
85+
//
86+
// //List Lua -> Native
87+
// LuaValue arrValue = _luaContext.evalScript("return {1, 'Hello World'};");
88+
// Log.v("lsc", arrValue.toString());
89+
// ArrayList arrayList1 = arrValue.toArrayList();
90+
// for (Object obj : arrayList1)
91+
// {
92+
// Log.v("LTN ArrayList", obj.toString());
93+
// }
94+
// List<?> list = arrValue.toList();
95+
// for (Object obj : list)
96+
// {
97+
// Log.v("LTN List", obj.toString());
98+
// }
99+
//
99100
//Map Native -> Lua
100101
HashMap<String, String> map = new HashMap<>();
101102
map.put("Hello", "World");
102103
map.put("aaa", "bbb");
104+
map.put("ccc", null);
103105
LuaValue mapValue = new LuaValue(map);
104106

105107
_luaContext.evalScript("function printMap (map) print('--------', #map); for k,v in pairs(map) do print(k, v); end end");
106108

107-
LuaValue[] mapArgs = new LuaValue[] {mapValue};
108-
_luaContext.callMethod("printMap", mapArgs);
109-
110-
//Map Lua -> Native
111-
LuaValue mapRetValue = _luaContext.evalScript("return {aaa=1, bbb='Hello World'};");
112-
Log.v("lsc", mapRetValue.toString());
113-
HashMap hashMap = mapRetValue.toHashMap();
114-
for (Object obj : hashMap.keySet())
115-
{
116-
Log.v("LTN HashMap", hashMap.get(obj).toString());
117-
}
118-
119-
Map<?, ?> map2 = mapRetValue.toMap();
120-
for (Object obj : map2.keySet())
121-
{
122-
Log.v("LTN Map", map2.get(obj).toString());
123-
}
124-
109+
// LuaValue[] mapArgs = new LuaValue[] {mapValue};
110+
// _luaContext.callMethod("printMap", mapArgs);
111+
//
112+
// //Map Lua -> Native
113+
// LuaValue mapRetValue = _luaContext.evalScript("return {aaa=1, bbb='Hello World'};");
114+
// Log.v("lsc", mapRetValue.toString());
115+
// HashMap hashMap = mapRetValue.toHashMap();
116+
// for (Object obj : hashMap.keySet())
117+
// {
118+
// Log.v("LTN HashMap", hashMap.get(obj).toString());
119+
// }
120+
//
121+
// Map<?, ?> map2 = mapRetValue.toMap();
122+
// for (Object obj : map2.keySet())
123+
// {
124+
// Log.v("LTN Map", map2.get(obj).toString());
125+
// }
126+
127+
// ArrayList<HashMap<String, String>> testList = new ArrayList<>();
128+
//
129+
// HashMap<String, String> m1 = new HashMap<>();
130+
// m1.put("aaa", "bbb");
131+
// m1.put("ccc", "dddd");
132+
// testList.add(m1);
133+
//
134+
// HashMap<String, String> m2 = new HashMap<>();
135+
// m2.put("eee", "ffff");
136+
// m2.put("ggg", "hhh");
137+
// testList.add(m2);
138+
//
139+
// LuaValue testValue = new LuaValue(testList);
140+
// _luaContext.evalScript("function printArray (arr) print('--------', #arr); for i,v in ipairs(arr) do print('------ elm = ', v); for m,n in pairs(v) do print(m, n); end end end");
141+
//
142+
// LuaValue[] args = new LuaValue[] {testValue};
143+
// _luaContext.callMethod("printArray", args);
125144

126145
}
127146
});

Sample/Android/app/src/main/java/cn/vimfung/luascriptcore/sample/NativeData.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
public class NativeData implements LuaExportType
1313
{
1414
public String dataId;
15+
1516
private HashMap<String, String> _data = new HashMap<String, String>();
1617

1718
public static Person createPerson()

Sample/Android/app/src/main/java/cn/vimfung/luascriptcore/sample/Person.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.util.HashMap;
77

88
import cn.vimfung.luascriptcore.LuaContext;
9+
import cn.vimfung.luascriptcore.LuaExclude;
910
import cn.vimfung.luascriptcore.LuaExportType;
1011
import cn.vimfung.luascriptcore.LuaExportTypeConfig;
1112
import cn.vimfung.luascriptcore.LuaFunction;
@@ -20,11 +21,14 @@
2021
public class Person implements LuaExportType
2122
{
2223
public String name;
24+
25+
@LuaExclude
2326
public void speak()
2427
{
2528
Log.v("luascriptcore", String.format("%s speak", name));
2629
}
2730

31+
@LuaExclude
2832
public void walk()
2933
{
3034
Log.v("luascriptcore", String.format("%s walk", name));

Source/Android/luascriptcore/compile-5.1.5.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android {
88
minSdkVersion 14
99
targetSdkVersion 24
1010
versionCode 20200
11-
versionName "2.2.0"
11+
versionName "2.3.0"
1212

1313
ndk {
1414
moduleName "LuaScriptCore"
@@ -87,7 +87,7 @@ ext {
8787
siteUrl = 'https://github.com/vimfung/LuaScriptCore'
8888
gitUrl = 'https://github.com/vimfung/LuaScriptCore.git'
8989

90-
libraryVersion = '2.2.1'
90+
libraryVersion = '2.3.0'
9191

9292
developerId = 'vimfung'
9393
developerName = 'Vim Fung'

Source/Android/luascriptcore/compile.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ android {
99
minSdkVersion 14
1010
targetSdkVersion 24
1111
versionCode 20200
12-
versionName "2.2.0"
12+
versionName "2.3.0"
1313

1414
ndk {
1515
moduleName "LuaScriptCore"
@@ -96,7 +96,7 @@ ext {
9696
siteUrl = 'https://github.com/vimfung/LuaScriptCore'
9797
gitUrl = 'https://github.com/vimfung/LuaScriptCore.git'
9898

99-
libraryVersion = '2.2.1'
99+
libraryVersion = '2.3.0'
100100

101101
developerId = 'vimfung'
102102
developerName = 'Vim Fung'

Source/Android/luascriptcore/src/main/jni/Android-5.1.5.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ LOCAL_PATH := $(call my-dir)
22
include $(CLEAR_VARS)
33

44
APP_PLATFORM := android-14
5-
65
LOCAL_MODULE := LuaScriptCore
76
LOCAL_LDFLAGS := -Wl,--build-id
87
LOCAL_LDLIBS := \
@@ -70,6 +69,7 @@ LOCAL_SRC_FILES := \
7069
../../../../../lua-common/LuaExportsTypeManager.cpp \
7170
../../../../../lua-common/LuaExportTypeDescriptor.cpp \
7271
../../../../../lua-common/LuaExportPropertyDescriptor.cpp \
72+
../../../../../lua-common/LuaOperationQueue.cpp \
7373

7474
LOCAL_C_INCLUDES += $(LOCAL_PATH)
7575
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../../lua-core-5.1.5/src

0 commit comments

Comments
 (0)