FluffOS - efun / contrib / file_length


Version: master

returns ‐ line count ‐ ‐1 in case of error (e.g insufficient privs) ‐ ‐2 if file is directory

This is a companion discussion topic for the original entry at http://fluffos.github.io/doc/efun/contrib/file_length.html


In testing, it returns 1 less than the number of lines in the file. It is mostly likely reading the contents of the file into an array, splitting the array by the line endings, and returning the largest index of the array.

If you want a true line count, simply increment by 1. Otherwise, you can override this in the simulated efun object of your mudlib to increment by 1 before returning.