Lukas Cavar screamed for hours, hoping to get someone’s attention. Bats, salamanders, crayfish and beetles were his only company.

Stranded in a cave without food or water, he was unsure that he would ever see his family again. He wrote notes to loved ones on his phone, which did not have a signal. He licked moisture off the cave walls and became so hungry he thought about eating crickets.

What was supposed to be a fun adventure turned into a hellish 58 hours for Cavar, a 19-year-old Indiana University student who was left behind during a group expedition on Sept. 17 to Sullivan Cave near Bloomington, Indiana.

When Cavar this year joined the university’s Caving Club, which organized the trip, he had never been spelunking before. During the outing, he and 11 others, including a university staff member, divided into two groups and explored for hours. Each person was assigned a “buddy” as a precaution, Cavar said.

Sullivan Cave is the fourth-longest in the state, with 9.63 miles of mapped passage, according to the cave’s owner, the Indiana Karst Conservancy. Cavar became separated from the group at a long passage with a low ceiling called the Backbreaker.

“I thought, I’m not really enjoying this Backbreaker part,” Cavar told The Indiana Daily Student, the university’s independent student newspaper, which first reported on the episode.

He left his group and tried to meet with the other one but got lost. He made his way back to the gate at the cave’s entrance but it was locked.

It was then he realized he was trapped — without food or water.

The club’s leaders, however, were unaware of his whereabouts. Cavar’s parents, who are both associate professors of linguistics at Indiana University, called the school on Tuesday and reported their son missing, said Ryan Piurek, a university spokesman.

Help arrived late Tuesday. Cavar was asleep, curled up at the bottom of the entrance of a cave when the bright lights of rescuers roused him.

“It took me a while to recognize the cave and to realize where I was,” he said in an email. “But as soon as it clicked in my brain, I scrambled up the remainder of the cave as fast as I could and climbed out. The rest was a blur.”

He spoke to his assigned buddy afterward.

“According to him, there was a buddy check at the mouth of the cave while the two groups were still separated,” Cavar said.

His buddy told the leaders that he didn’t see Cavar, and it was assumed he was with the other group. “The car-pooling cars got reshuffled, since some people had to leave early, and so no one noticed I was gone,” Cavar said.

On an internal Indiana University website, the club posted a statement that the student newspaper published.

“We have a series of rigorous protocols in place that are supposed to prevent situations like this, but they are only effective if followed,” it said. “We had a failure in our leadership to closely follow all these safety procedures.”

The club’s website lists safety guidelines, including a reminder to always tell someone where you’re going and when you expect to return.

Matt Pelsor, chairman of the Central Indiana Grotto, a caving group, described what happened as a “series of oversights” at a cave that is well known and visited often.

“I’ve been in this cave many times and there wasn’t any reason why this should have happened,” he said, adding that the passage where Cavar got separated from the group “is one that is used almost every time there is a trip taken into this cave.”

Piurek, the Indiana University spokesman, called Cavar “brave and resourceful” and said the school was relieved he had been found unharmed.

Jess Deli, central region coordinator with the National Cave Rescue Commission, said she could not comment about what happened to Cavar but said in general, caving is safe and there are “very few” rescues that happen across the nation.

Cavar said Saturday that he was doing “relatively fine” and didn’t suffer any serious injuries.

“I think I just ought to take it easy for a while,” he said.