\documentclass{article}

\title{Lua\TeX~Test}
\author{Khaled Hosny}

%\externalocp\OCPbidi=bidi.py {}
%     \ocplist\bidi=
%     \addbeforeocplist 100 \OCPbidi
%     \nullocplist
%\pushocplist\bidi

\pagedir TRT\bodydir TRT\pardir TRT\textdir TRT

\begin{document}
\maketitle
\tableofcontents

\section{Hello {world}}
Hi there.

\subsection{Hello again}
How are you doing.

\subsubsection{Hello!}
Help pleeeeeez.

\section{Hi}
Any one there?

\subsection{Hello again}
How are you doing.

\subsubsection{Hello!}
Help pleeeeeez.
\end{document}
