The main purpose of this paper is to obtain more appropriate design for truss structures using a discrete novel nature-inspired optimization algorithm. The so-called Dragonfly Algorithm (DA) was employed to achieve the aim of this paper. The inspiration of the DA emerges from behaviors of static and dynamic swarming of dragonflies in the nature. The DA was originally developed for continuous optimization problems. This paper proposes some amendments to the DA for solving discrete functions of optimization problems and improving the performance of the algorithm. The modified algorithm was examined on five well-known planar and spatial steel trusses with discrete sizing variables. The effectiveness and robustness of the proposed algorithm were verified by comparing the new method with various widely-known metaheuristic algorithms. The numerical results demonstrate that the DA is more effective and accurate than other algorithms in terms of achieving the lightest weight with minimum number of structural analysis and satisfying the required structural constraints.