Skip to content

Commit

Permalink
泛型新写法的文档
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Jul 26, 2018
1 parent 891c2a1 commit 974f190
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Assets/XLua/Doc/Faq_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@ dic:Add('a', CS.UnityEngine.Vector3(1, 2, 3))
print(dic:TryGetValue('a'))
~~~

If your xLua version is larger than v2.1.12, you can

~~~lua
local List_String = CS.System.Collections.Generic.List(CS.System.String)
local lst = List_String()
~~~

## Why is the "try to dispose a LuaEnv with C# callback!" error reported when LuaEnv.Dispose is called?

This is because C# still has a delegate pointing to a function in the Lua virtual machine. Check this to prevent calling these invalid delegates after the virtual machine is released (They are invalid because the virtual machine on which the Lua function is referenced has been released.) from causing exceptions or even crashes.
Expand Down
8 changes: 8 additions & 0 deletions Assets/XLua/Doc/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,14 @@ dic:Add('a', CS.UnityEngine.Vector3(1, 2, 3))
print(dic:TryGetValue('a'))
~~~

如果你的xLua版本大于v2.1.12,将会有更漂亮的表达方式

~~~lua
local List_String = CS.System.Collections.Generic.List(CS.System.String)
local lst = List_String()
~~~


## 调用LuaEnv.Dispose时,报“try to dispose a LuaEnv with C# callback!”错是什么原因?

这是由于C#还存在指向lua虚拟机里头某个函数的delegate,为了防止业务在虚拟机释放后调用这些无效(因为其引用的lua函数所在虚拟机都释放了)delegate导致的异常甚至崩溃,做了这个检查。
Expand Down

0 comments on commit 974f190

Please sign in to comment.