Just calling :talentDialog() again obviously doesn't work (well, it's obvious now that I've tried it and it broke badly…
 ).  The second most obvious approach is to mimic the coroutine juggling done by :talentDialog() itself:
 ).  The second most obvious approach is to mimic the coroutine juggling done by :talentDialog() itself:
Code: Select all
function _M:nestedTalentDialog(d)
  local co = coroutine.create(function()
    print('[DEBUG] entering nestedTalentDialog coroutine')
    local ret = self.actor:talentDialog(d)
    print(('[DEBUG] nestedTalentDialog coroutine returning %s'):format(tostring(ret)))
    return ret
  end)
  local ok, ret = coroutine.resume(co)
  print(('[DEBUG] nestedTalentDialog returned %s, %s'):format(tostring(ok), tostring(err)))
  if not ok then
    print(debug.traceback(co))
    if ret then error(ret) end
    return nil
  end
  return ret
end
I'm hoping someone more familiar with Lua coroutines than I am can see what I'm doing wrong here. Any ideas? I'm really not sure how I can rearchitect this if this can't be done…