coolian 0 Posted February 8, 2023 Share Posted February 8, 2023 how do i check that stdin exists? at the moment i try to do it like so if io.stdin ~= nil then -- read stdin end however i get the error "attempt to index a nil value (field 'stdin')" how is this even possible if im checking if it is nil? i am using this in an attempt to recreate the 'tee' tool from linux Quote Link to post Share on other sites
1 Molinko 43 Posted March 17, 2023 Share Posted March 17, 2023 I'd bet that the io object is just a table and there's some metamethod stuff going on. So, testing for the field 'stdin' is actually nil. Maybe try simply 'io.read' or 'term.read' and testing the return value(s) Quote Link to post Share on other sites
how do i check that stdin exists?
at the moment i try to do it like so
however i get the error "attempt to index a nil value (field 'stdin')"
how is this even possible if im checking if it is nil?
i am using this in an attempt to recreate the 'tee' tool from linux
Link to post
Share on other sites