The scalar field theory of cosmological inflation constitutes nowadays one of the preferred scenarios for the physics of the early universe. In this talk I will focus on how to study the inflationary universe on a discrete lattice with a numerical simulation. Various lattice codes have been written in the last decades and have been extensively used for understanding the reheating phase of the universe, but they have never been used to study the inflationary phase itself far from the end of inflation (i.e. roughly 50 e-folds before the end). Following 2102.06378 I will explain how to reproduce the well known results of some simple models of single field inflation with a non-linear lattice simulation, particularly for the scalar field perturbation. I will show that in order to reproduce with precision the results of the continuous linear theory, we need to take into account various discretisation effects such as the modified dispersion relation of plane waves propagating on the discrete lattice. Even if a lattice simulation is not needed to understand the physics of the well-known models considered in this talk, that are well within the regime of validity of linear perturbation theory, understanding these effects is important if one wants to use a lattice simulations to study more complicated models of inflation.