Skip to content

Commit 71d526d

Browse files
committed
2 parents 4604240 + fda16bd commit 71d526d

File tree

7 files changed

+22
-1
lines changed

7 files changed

+22
-1
lines changed

Runtime/Code/Luau/LuauCoreCallbacks.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public partial class LuauCore : MonoBehaviour {
4646

4747
private struct AwaitingTask
4848
{
49+
#if UNITY_EDITOR
50+
public string DebugName;
51+
#endif
4952
public IntPtr Thread;
5053
public Task Task;
5154
public MethodInfo Method;
@@ -1523,6 +1526,9 @@ private static int InvokeMethodAsync(LuauContext context, IntPtr thread, Type ty
15231526
try {
15241527
var task = (Task)method.Invoke(obj, parameters.Array);
15251528
var awaitingTask = new AwaitingTask {
1529+
#if UNITY_EDITOR
1530+
DebugName = $"{method.Name} ({method.DeclaringType.FullName})",
1531+
#endif
15261532
Thread = thread,
15271533
Task = task,
15281534
Method = method,
@@ -1589,7 +1595,12 @@ private static void ResumeAsyncTask(AwaitingTask awaitingTask, bool immediate =
15891595
}
15901596

15911597
if (!immediate) {
1592-
var result = LuauPlugin.LuauResumeThread(thread, nArgs);
1598+
var result = -1;
1599+
try {
1600+
result = LuauPlugin.LuauResumeThread(thread, nArgs);
1601+
} catch (LuauException e) {
1602+
Debug.LogException(e);
1603+
}
15931604
if (binding != null) {
15941605
binding.m_asyncYield = false;
15951606
binding.m_canResume = result == 1;

Runtime/Code/Luau/LuauPlugin.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,4 +742,14 @@ public static string LuauGetLuauPluginVersion() {
742742
var len = GetLuauPluginVersion(out var versionPtr);
743743
return Marshal.PtrToStringUTF8(versionPtr, len);
744744
}
745+
746+
#if UNITY_IPHONE
747+
[DllImport("__Internal")]
748+
#else
749+
[DllImport("LuauPlugin")]
750+
#endif
751+
private static extern void DebugPrintStack(IntPtr thread);
752+
public static void LuauDebugPrintStack(IntPtr thread) {
753+
DebugPrintStack(thread);
754+
}
745755
}
88 Bytes
Binary file not shown.
144 Bytes
Binary file not shown.
1 KB
Binary file not shown.
8 KB
Binary file not shown.
22.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)