What is exact difference between implicit functions and explicit function in lua ? I came across these terms while reading about file operations in Lua.Implicit functions are preceded by io.like io.read()whereas explicit functions look something like file:read().I am clueless about the difference though the book says
The difference between the two is that implicit functions work on the default file as provided by the
ionamespace, whereas explicit functions work with a file handle provided from a previous operation,such asio.open
Any better explanation, please ?
io.read reads from the default input file.
The default input file is stdin, but you change it by calling io.input.
You can also open a file explicitly with io.open and the use the returned handle in method calls, such as f:read().
io.read() is equivalent to io.input():read().
See also http://www.lua.org/manual/5.2/manual.html#6.8.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With