Here is a code chunk to read the contents of a file at the given path which seems widely used
path
local file = open(path, "r") local content = file:read("*a") file:close()
People say that "*a" allows to read the whole file but I find no mention of it in the 5.4 reference manual contrary to the "a" format specifier.
"*a"
"a"
What is the meaning of the *?
*
Asterisk was used in formats in versions before 5.3 (e.g. 4.0 or 5.2).
Currently it's supported for the sake of compatibility: g_read. Formats with and without * are equivalent.
2.1m questions
2.1m answers
60 comments
57.0k users