Looks like the function has multiple return values. In the first code block you were printing everything that the function returns, on the second one you are grabbing the first value ( type ) and not the second value (id)
actionType, id, subType = GetActionInfo(slot)
https://warcraft.wiki.gg/wiki/API_GetActionInfo