|
--This goes somewhere very early in your code, before opening any file.dolocal files={}local oldopen=io.openfunction io.open(f,m)local r=oldopen(f,m)___files[r]=mreturn rendfunction io.getmode(handle)return ___files[handle]endend
t=io.open("/dev/random","r")--This will print "r".print(io.getmode(t))--And probably this would also work but I haven't tested it: t:getmode()