Search code examples
lualuajittorch

How to specify startup file for Torch REPL


I'd like to define some command line convenience functions to be run every time I start the Torch REPL. For example,

function cl() os.execute('clear') end

and things of that nature. How can I have functions like this added to the namespace every time I start the REPL?

I web searched "luajit|torch|trepl startup|rc file" but couldn't find any leads on this.


Solution

  • you can alias your th repl to take a default -l parameter:

    alias thnew='th -lmyadditions '
    

    where myadditions.lua is your file to be executed that is placed in your lua path.