Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pangweiwei/slua
Browse files Browse the repository at this point in the history
  • Loading branch information
pangweiwei committed Jul 28, 2015
2 parents 0f995db + 33894bd commit d45040a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Assets/Slua/Editor/LuaCodeGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ void RegEnumFunction(Type t, StreamWriter file)
{
// Write export function
Write(file, "static public void reg(IntPtr l) {");
Write(file, "getEnumTable(l,\"{0}\");", FullName(t));
Write(file, "getEnumTable(l,\"{0}\");", string.IsNullOrEmpty(givenNamespace) ? FullName(t) : givenNamespace);

FieldInfo[] fields = t.GetFields();
foreach (FieldInfo f in fields)
Expand Down Expand Up @@ -837,7 +837,7 @@ void RegFunction(Type t, StreamWriter file)
Write(file, "LuaUnityEvent_{1}.reg(l);", FullName(t), _Name((GenericName(t.BaseType))));
}

Write(file, "getTypeTable(l,\"{0}\");", givenNamespace != null ? givenNamespace : FullName(t));
Write(file, "getTypeTable(l,\"{0}\");", string.IsNullOrEmpty(givenNamespace) ? FullName(t) : givenNamespace);
foreach (string f in funcname)
{
Write(file, "addMember(l,{0});", f);
Expand Down Expand Up @@ -1488,7 +1488,7 @@ void WriteCheckSelf(StreamWriter file, Type t)
{
if (t.IsValueType)
{
Write(file, "{0} self;", FullName(t));
Write(file, "{0} self;", TypeDecl(t));
Write(file, "checkType(l,1,out self);");
}
else
Expand Down
8 changes: 8 additions & 0 deletions Assets/Slua/Script/LuaState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,14 @@ static int init(IntPtr L)
if not ret[1] then UnityEngine.Debug.LogError(debug.traceback(co,ret[2])) end
return unpack(ret)
end
coroutine.wrap = function(func)
local co = coroutine.create(func)
return function(...)
local ret={coroutine.resume(co,...)}
return unpack(ret, 2)
end
end
";

// overload resume function for report error
Expand Down

0 comments on commit d45040a

Please sign in to comment.