Skip to content

mah0x211/lua-io-fileno

Repository files navigation

lua-io-fileno

test codecov

get the file descriptor from the lua file handle.

Installation

luarocks install io-fileno

fd = fileno( f )

get the file descriptor from the lua file handle.

Parameters

  • f:file: lua file handle.

Returns

  • fd:integer: the file descriptor.

e.g.

local fileno = require('io.fileno')
local f = assert(io.open('./test.txt', 'w'))

-- returns a file descriptor that greater than 0
print(fileno(f)) 

f:close()
-- returns -1
print(fileno(f))

About

get the file descriptor from the lua file handle.

Resources

License

Stars

Watchers

Forks

Packages

No packages published