Mix sugar, cocoa powder, and salt in a microwave-safe mixing bowl. Pour milk over the sugar mixture. Arrange margarine pieces atop the mixture, but do not mix into it.
Heat in microwave for 2 minutes. Stir the mixture thoroughly and heat for 1 minute more; stir again.
Fold nuts into the chocolate mixture; add vanilla and stir.
Grease an 8-inch glass baking dish with butter. Pour batter into the prepared dish.