@@ -1111,9 +1111,18 @@ static int L_CallPlugin (lua_State *L)
1111
1111
unsigned short iOldStyle = pDoc->m_iNoteStyle ;
1112
1112
pDoc->m_iNoteStyle = NORMAL; // back to default style
1113
1113
1114
+ CString strOldCallingPluginID = pPlugin->m_strCallingPluginID ;
1115
+
1116
+ pPlugin->m_strCallingPluginID .Empty ();
1117
+
1118
+ if (pDoc->m_CurrentPlugin )
1119
+ pPlugin->m_strCallingPluginID = pDoc->m_CurrentPlugin ->m_strID ;
1120
+
1114
1121
// do this so plugin can find its own state (eg. with GetPluginID)
1115
1122
CPlugin * pSavedPlugin = pDoc->m_CurrentPlugin ;
1116
- pDoc->m_CurrentPlugin = pPlugin;
1123
+ pDoc->m_CurrentPlugin = pPlugin;
1124
+
1125
+
1117
1126
1118
1127
// now call the routine in the plugin
1119
1128
@@ -1152,12 +1161,15 @@ static int L_CallPlugin (lua_State *L)
1152
1161
// what the exact Lua error message was (result value 3)
1153
1162
lua_pushstring (L, strLuaError);
1154
1163
1164
+ pPlugin->m_strCallingPluginID = strOldCallingPluginID;
1165
+
1155
1166
return 3 ; // ie. eErrorCallingPluginRoutine, explanation, Lua error message
1156
1167
}
1157
1168
1158
1169
// back to who *we* are (if no error)
1159
1170
pDoc->m_CurrentPlugin = pSavedPlugin;
1160
1171
pDoc->m_iNoteStyle = iOldStyle;
1172
+ pPlugin->m_strCallingPluginID = strOldCallingPluginID;
1161
1173
1162
1174
int ret_n = lua_gettop (pL); // number of returned values (might be zero)
1163
1175
0 commit comments