Skip to content

Commit

Permalink
1、修复Unity下LuaFunction的释放时机问题
Browse files Browse the repository at this point in the history
2、增加Unity下LuaManagedValue类型,用于管理Lua对象的生命周期


Former-commit-id: 61823786388a8dcc9d08c46e9f33640c71cf9c03
  • Loading branch information
vimfung committed May 24, 2017
1 parent 61b0630 commit f7cd282
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
Binary file removed Source/Unity3D/UnityProject/Assets/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;

namespace cn.vimfung.luascriptcore
{
public class LuaManagedValue : LuaBaseObject
{
private LuaValue _source;
private LuaContext _context;

public LuaManagedValue (LuaValue value, LuaContext context)
{
_source = value;
_context = context;

_context.retainValue (_source);
}

~LuaManagedValue ()
{
if (_context != null && _source != null)
{
_context.releaseValue (_source);
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f7cd282

Please sign in to comment.