public Task <bool> Start(ILua lua, GetILuaFromLuaStatePointer lua_extructor, ModuleAssemblyLoadContext _) { this.lua_extructor = lua_extructor; TaskCompletionSource <bool> taskCompletion = new TaskCompletionSource <bool>(); try { string closure_upvalue = Guid.NewGuid().ToString(); lua.PushString(closure_upvalue); lua.PushCClosure(closure_ptr, 1); lua.MCall(0, 1); string received_string = lua.GetString(-1); lua.Pop(1); if (received_string != (closure_upvalue + string_to_add)) { throw new PushCClosureTestException("Received string is invalid"); } taskCompletion.TrySetResult(true); } catch (Exception e) { taskCompletion.TrySetException(new Exception[] { e }); } return(taskCompletion.Task); }