Created a way for Lua to manage states.