Skip to content

Commit 9d88db3

Browse files
committed
更新tolua#到1.0.7.327版
1 parent 9161fe2 commit 9d88db3

30 files changed

Lines changed: 547 additions & 513 deletions

Assets/LuaFramework/ToLua/BaseType/System_ArrayWrap.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ static int get_LongLength(IntPtr L)
13471347
}
13481348
catch (Exception e)
13491349
{
1350-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index LongLength on a nil value" : e.Message);
1350+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index LongLength on a nil value");
13511351
}
13521352
}
13531353

@@ -1366,7 +1366,7 @@ static int get_Rank(IntPtr L)
13661366
}
13671367
catch (Exception e)
13681368
{
1369-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Rank on a nil value" : e.Message);
1369+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Rank on a nil value");
13701370
}
13711371
}
13721372

@@ -1385,7 +1385,7 @@ static int get_IsSynchronized(IntPtr L)
13851385
}
13861386
catch (Exception e)
13871387
{
1388-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index IsSynchronized on a nil value" : e.Message);
1388+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsSynchronized on a nil value");
13891389
}
13901390
}
13911391

@@ -1404,7 +1404,7 @@ static int get_SyncRoot(IntPtr L)
14041404
}
14051405
catch (Exception e)
14061406
{
1407-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index SyncRoot on a nil value" : e.Message);
1407+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index SyncRoot on a nil value");
14081408
}
14091409
}
14101410

@@ -1423,7 +1423,7 @@ static int get_IsFixedSize(IntPtr L)
14231423
}
14241424
catch (Exception e)
14251425
{
1426-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index IsFixedSize on a nil value" : e.Message);
1426+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsFixedSize on a nil value");
14271427
}
14281428
}
14291429

@@ -1442,7 +1442,7 @@ static int get_IsReadOnly(IntPtr L)
14421442
}
14431443
catch (Exception e)
14441444
{
1445-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index IsReadOnly on a nil value" : e.Message);
1445+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsReadOnly on a nil value");
14461446
}
14471447
}
14481448
}

Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_DictionaryWrap.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ static int get_Count(IntPtr L)
356356
}
357357
catch (Exception e)
358358
{
359-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Count on a nil value" : e.Message);
359+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Count on a nil value");
360360
}
361361
}
362362

@@ -374,7 +374,7 @@ static int get_Comparer(IntPtr L)
374374
}
375375
catch (Exception e)
376376
{
377-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Comparer on a nil value" : e.Message);
377+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Comparer on a nil value");
378378
}
379379
}
380380

@@ -392,7 +392,7 @@ static int get_Keys(IntPtr L)
392392
}
393393
catch (Exception e)
394394
{
395-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Keys on a nil value" : e.Message);
395+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Keys on a nil value");
396396
}
397397
}
398398

@@ -410,7 +410,7 @@ static int get_Values(IntPtr L)
410410
}
411411
catch (Exception e)
412412
{
413-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Values on a nil value" : e.Message);
413+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Values on a nil value");
414414
}
415415
}
416416
}

Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_Dictionary_KeyCollectionWrap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static int get_Count(IntPtr L)
9292
}
9393
catch (Exception e)
9494
{
95-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Count on a nil value" : e.Message);
95+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Count on a nil value");
9696
}
9797
}
9898
}

Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_Dictionary_ValueCollectionWrap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static int get_Count(IntPtr L)
9292
}
9393
catch (Exception e)
9494
{
95-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Count on a nil value" : e.Message);
95+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Count on a nil value");
9696
}
9797
}
9898
}

Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_KeyValuePairWrap.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static int get_Key(IntPtr L)
2727
}
2828
catch (Exception e)
2929
{
30-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Key on a nil value" : e.Message);
30+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Key on a nil value");
3131
}
3232
}
3333

@@ -45,7 +45,7 @@ static int get_Value(IntPtr L)
4545
}
4646
catch (Exception e)
4747
{
48-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Value on a nil value" : e.Message);
48+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Value on a nil value");
4949
}
5050
}
5151
}

Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_ListWrap.cs

Lines changed: 22 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -232,21 +232,9 @@ static int Exists(IntPtr L)
232232
try
233233
{
234234
ToLua.CheckArgsCount(L, 2);
235-
Type argType = null;
236-
Delegate arg0 = null;
237-
object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);
238-
LuaTypes funcType2 = LuaDLL.lua_type(L, 2);
239-
240-
if (funcType2 != LuaTypes.LUA_TFUNCTION)
241-
{
242-
arg0 = (Delegate)ToLua.CheckObject(L, 2, typeof(System.Predicate<>).MakeGenericType(argType));
243-
}
244-
else
245-
{
246-
LuaFunction func = ToLua.ToLuaFunction(L, 2);
247-
arg0 = DelegateFactory.CreateDelegate(typeof(System.Predicate<>).MakeGenericType(argType), func);
248-
}
249-
235+
Type argType = null;
236+
object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);
237+
Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2);
250238
bool o = (bool)LuaMethodCache.CallMethod("Exists", obj, arg0);
251239
LuaDLL.lua_pushboolean(L, o);
252240
return 1;
@@ -263,21 +251,9 @@ static int Find(IntPtr L)
263251
try
264252
{
265253
ToLua.CheckArgsCount(L, 2);
266-
Type argType = null;
267-
Delegate arg0 = null;
268-
object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);
269-
LuaTypes funcType2 = LuaDLL.lua_type(L, 2);
270-
271-
if (funcType2 != LuaTypes.LUA_TFUNCTION)
272-
{
273-
arg0 = (Delegate)ToLua.CheckObject(L, 2, typeof(System.Predicate<>).MakeGenericType(argType));
274-
}
275-
else
276-
{
277-
LuaFunction func = ToLua.ToLuaFunction(L, 2);
278-
arg0 = DelegateFactory.CreateDelegate(typeof(System.Predicate<>).MakeGenericType(argType), func);
279-
}
280-
254+
Type argType = null;
255+
object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);
256+
Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2);
281257
object o = LuaMethodCache.CallMethod("Find", obj, arg0);
282258
ToLua.Push(L, o);
283259
return 1;
@@ -294,21 +270,9 @@ static int FindAll(IntPtr L)
294270
try
295271
{
296272
ToLua.CheckArgsCount(L, 2);
297-
Type argType = null;
298-
Delegate arg0 = null;
273+
Type argType = null;
299274
object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);
300-
LuaTypes funcType2 = LuaDLL.lua_type(L, 2);
301-
302-
if (funcType2 != LuaTypes.LUA_TFUNCTION)
303-
{
304-
arg0 = (Delegate)ToLua.CheckObject(L, 2, typeof(System.Predicate<>).MakeGenericType(argType));
305-
}
306-
else
307-
{
308-
LuaFunction func = ToLua.ToLuaFunction(L, 2);
309-
arg0 = DelegateFactory.CreateDelegate(typeof(System.Predicate<>).MakeGenericType(argType), func);
310-
}
311-
275+
Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2);
312276
object o = LuaMethodCache.CallMethod("FindAll", obj, arg0);
313277
ToLua.Push(L, o);
314278
return 1;
@@ -329,25 +293,25 @@ static int FindIndex(IntPtr L)
329293
object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);
330294

331295
if (count == 2)
332-
{
333-
Delegate arg0 = (Delegate)ToLua.CheckObject(L, 2, typeof(System.Predicate<>).MakeGenericType(argType));
296+
{
297+
Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2);
334298
int o = (int)LuaMethodCache.CallMethod("FindIndex", obj, arg0);
335299
LuaDLL.lua_pushinteger(L, o);
336300
return 1;
337301
}
338302
else if (count == 3)
339303
{
340304
int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
341-
Delegate arg1 = (Delegate)ToLua.CheckObject(L, 3, typeof(System.Predicate<>).MakeGenericType(argType));
305+
Delegate arg1 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 3);
342306
int o = (int)LuaMethodCache.CallMethod("FindIndex", obj, arg0, arg1);
343307
LuaDLL.lua_pushinteger(L, o);
344308
return 1;
345309
}
346310
else if (count == 4)
347311
{
348312
int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
349-
int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
350-
Delegate arg2 = (Delegate)ToLua.CheckObject(L, 4, typeof(System.Predicate<>).MakeGenericType(argType));
313+
int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
314+
Delegate arg2 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 4);
351315
int o = (int)LuaMethodCache.CallMethod("FindIndex", obj, arg0, arg1, arg2);
352316
LuaDLL.lua_pushinteger(L, o);
353317
return 1;
@@ -369,21 +333,9 @@ static int FindLast(IntPtr L)
369333
try
370334
{
371335
ToLua.CheckArgsCount(L, 2);
372-
Type argType = null;
373-
Delegate arg0 = null;
374-
object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);
375-
LuaTypes funcType2 = LuaDLL.lua_type(L, 2);
376-
377-
if (funcType2 != LuaTypes.LUA_TFUNCTION)
378-
{
379-
arg0 = (Delegate)ToLua.CheckObject(L, 2, typeof(System.Predicate<>).MakeGenericType(argType));
380-
}
381-
else
382-
{
383-
LuaFunction func = ToLua.ToLuaFunction(L, 2);
384-
arg0 = DelegateFactory.CreateDelegate(typeof(System.Predicate<>).MakeGenericType(argType), func);
385-
}
386-
336+
Type argType = null;
337+
object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);
338+
Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2);
387339
object o = LuaMethodCache.CallSingleMethod("FindLast", obj, arg0);
388340
ToLua.Push(L, o);
389341
return 1;
@@ -446,19 +398,7 @@ static int ForEach(IntPtr L)
446398
ToLua.CheckArgsCount(L, 2);
447399
Type argType = null;
448400
object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);
449-
Delegate arg0 = null;
450-
LuaTypes funcType2 = LuaDLL.lua_type(L, 2);
451-
452-
if (funcType2 != LuaTypes.LUA_TFUNCTION)
453-
{
454-
arg0 = (Delegate)ToLua.CheckObject(L, 2, typeof(System.Action<>).MakeGenericType(argType));
455-
}
456-
else
457-
{
458-
LuaFunction func = ToLua.ToLuaFunction(L, 2);
459-
arg0 = DelegateFactory.CreateDelegate(typeof(System.Action<>).MakeGenericType(argType), func);
460-
}
461-
401+
Delegate arg0 = ToLua.CheckDelegate(typeof(System.Action<>).MakeGenericType(argType), L, 2);
462402
LuaMethodCache.CallSingleMethod("ForEach", obj, arg0);
463403
return 0;
464404
}
@@ -657,19 +597,7 @@ static int RemoveAll(IntPtr L)
657597
ToLua.CheckArgsCount(L, 2);
658598
Type argType = null;
659599
object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);
660-
Delegate arg0 = null;
661-
LuaTypes funcType2 = LuaDLL.lua_type(L, 2);
662-
663-
if (funcType2 != LuaTypes.LUA_TFUNCTION)
664-
{
665-
arg0 = (Delegate)ToLua.CheckObject(L, 2, typeof(System.Predicate<>).MakeGenericType(argType));
666-
}
667-
else
668-
{
669-
LuaFunction func = ToLua.ToLuaFunction(L, 2);
670-
arg0 = DelegateFactory.CreateDelegate(typeof(System.Predicate<>).MakeGenericType(argType), func);
671-
}
672-
600+
Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2);
673601
int o = (int)LuaMethodCache.CallSingleMethod("RemoveAll", obj, arg0);
674602
LuaDLL.lua_pushinteger(L, o);
675603
return 1;
@@ -833,19 +761,7 @@ static int TrueForAll(IntPtr L)
833761
ToLua.CheckArgsCount(L, 2);
834762
Type argType = null;
835763
object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);
836-
Delegate arg0 = null;
837-
LuaTypes funcType2 = LuaDLL.lua_type(L, 2);
838-
839-
if (funcType2 != LuaTypes.LUA_TFUNCTION)
840-
{
841-
arg0 = (Delegate)ToLua.CheckObject(L, 2, typeof(System.Predicate<>).MakeGenericType(argType));
842-
}
843-
else
844-
{
845-
LuaFunction func = ToLua.ToLuaFunction(L, 2);
846-
arg0 = DelegateFactory.CreateDelegate(typeof(System.Predicate<>).MakeGenericType(argType), func);
847-
}
848-
764+
Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2);
849765
bool o = (bool)LuaMethodCache.CallSingleMethod("TrueForAll", obj, arg0);
850766
LuaDLL.lua_pushboolean(L, o);
851767
return 1;
@@ -907,7 +823,7 @@ static int get_Capacity(IntPtr L)
907823
}
908824
catch(Exception e)
909825
{
910-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Capacity on a nil value" : e.Message);
826+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Capacity on a nil value");
911827
}
912828
}
913829

@@ -925,7 +841,7 @@ static int get_Count(IntPtr L)
925841
}
926842
catch(Exception e)
927843
{
928-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Count on a nil value" : e.Message);
844+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Count on a nil value");
929845
}
930846
}
931847

@@ -943,7 +859,7 @@ static int set_Capacity(IntPtr L)
943859
}
944860
catch(Exception e)
945861
{
946-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Capacity on a nil value" : e.Message);
862+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Capacity on a nil value");
947863
}
948864
}
949865
}

Assets/LuaFramework/ToLua/BaseType/System_Collections_IEnumeratorWrap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static int get_Current(IntPtr L)
6161
}
6262
catch(Exception e)
6363
{
64-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Current on a nil value" : e.Message);
64+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Current on a nil value");
6565
}
6666
}
6767
}

Assets/LuaFramework/ToLua/BaseType/System_Collections_ObjectModel_ReadOnlyCollectionWrap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static int get_Count(IntPtr L)
125125
}
126126
catch (Exception e)
127127
{
128-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Count on a nil value" : e.Message);
128+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Count on a nil value");
129129
}
130130
}
131131
}

Assets/LuaFramework/ToLua/BaseType/System_DelegateWrap.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ static int get_Method(IntPtr L)
445445
}
446446
catch(Exception e)
447447
{
448-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Method on a nil value" : e.Message);
448+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Method on a nil value");
449449
}
450450
}
451451

@@ -464,7 +464,7 @@ static int get_Target(IntPtr L)
464464
}
465465
catch(Exception e)
466466
{
467-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Target on a nil value" : e.Message);
467+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Target on a nil value");
468468
}
469469
}
470470
}

Assets/LuaFramework/ToLua/BaseType/System_StringWrap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ static int get_Length(IntPtr L)
16851685
}
16861686
catch(Exception e)
16871687
{
1688-
return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Length on a nil value" : e.Message);
1688+
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Length on a nil value");
16891689
}
16901690
}
16911691
}

0 commit comments

Comments
 (0)