What are the differences between doFile and require in Lua, especially in Torch? When do you call one but not the other? When will one work but the other won't? (I'm using Lua 5.1, torch7).
相关问题
- How to get the return code of a shell script in lu
- Accessing Light userdata in Lua
- How to convert a list of tensors into a torch::Ten
- Wireshark dissector that works with tls/ssl
- Email address validation using corona sdk
相关文章
- RuntimeError: Expected object of backend CUDA but
- Lua Integer type
- First character uppercase Lua
- torch / lua: retrieving n-best subset from Tensor
- How to handle errors when resuming a Lua thread (c
- Is Lua an object-oriented language?
- Getting previous day's date in Lua
- How do I create a save game feature in love2d?
dofile
loads and executes a file right then and there.require
is more complicated; it keeps a table of modules that have already been loaded and their return results, to ensure that the same code isn't loaded twice. It also keeps a list of module loaders that handle loading a module, one of which that can load fromdll
/so
files.You probably want
require
, as if you're just loading functions, you don't want to duplicate them.