Skip to content

Commit

Permalink
import_type函数bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-kelly committed Nov 17, 2016
1 parent 65280c2 commit 5f08dc7
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,25 @@ public IEnumerator Init()
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static public int ImportCSharpType(IntPtr l)
{
return Helper.GetClass(l);
try
{
string cls;
Helper.checkType(l, 1, out cls);
Type t = LuaObject.FindType(cls);
if (t == null)
{
return Helper.error(l, "Can't find {0} to create", cls);
}

LuaClassObject co = new LuaClassObject(t);
LuaObject.pushObject(l,co);
Helper.pushValue(l, true);
return 2;
}
catch (Exception e)
{
return Helper.error(l, e);
}
}
/// <summary>
/// same as SLua default import
Expand Down

0 comments on commit 5f08dc7

Please sign in to comment.