Created
August 8, 2018 12:54
-
-
Save altexy/06e699d03492a822a9579873488c1055 to your computer and use it in GitHub Desktop.
Lua read file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function read_file(path) | |
local file = io_open(path, "rb") -- r read mode and b binary mode | |
if not file then return nil, "Cannot open file: " .. path end | |
local content = file:read "*a" -- *a or *all reads the whole file | |
file:close() | |
return content | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment