What is the meaning and function of "幸" in the following sentence?
幸 in this context means to hope for.
My old man is your old man. If you want to boil your old man alive, then I hope that you’ll share a portion of the soup with me.
As far as I can find, the original text says 必欲烹「而」翁 rather than 必欲烹「爾」翁, but the interpretation is the same.
幸 is hope that. The excerpt is from 《史记》 项羽 threatened 刘邦 that he would boil 刘邦's father alive. But 刘邦 was not afraid of him and said: "吾(my)翁(father)即(is)若(your)翁。(if you)必(must)欲(will,want)烹(boil alive)爾(your)翁,則(conjunction)(I)幸(hope)分(share)我(me)一杯(a bowl of)羹(soup)。
Note: 刘邦 and 项羽 once 拜为兄弟
幸 literally means 'feel lucky for' or 'happy for'
My old man is your old man. If you want to boil your old man alive, then I would be happy to share a portion of the soup.
'hope for' is extended meaning of 'happy for' -- When you are happy for something to happen, you are hoping for it to happen
In the idiom: "幸災樂禍" (happy to see other people suffer) both 幸 and 樂 mean 'happy for'; 災禍 means disaster