check argument type in newFile(), fixes #4

This commit is contained in:
megagrump
2021-07-11 19:40:44 +02:00
parent c01aea7dfa
commit dbfefa28c2
2 changed files with 9 additions and 0 deletions

View File

@@ -216,6 +216,9 @@ local nativefs = {}
local loveC = ffi.os == 'Windows' and ffi.load('love') or C
function nativefs.newFile(name)
if type(name) ~= 'string' then
error("bad argument #1 to 'newFile' (string expected, got " .. type(name) .. ")")
end
return setmetatable({
_name = name,
_mode = 'c',