Questions tagged [luafilesystem]

It is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution.

Overview

LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution.

It offers a portable way to access the underlying directory structure and file attributes.

License

LuaFileSystem is free software and uses the same license as Lua 5.1.

Useful resources

Wiki excerpt from online documentation pages

22 questions
16
votes
1 answer

Creating a temporary file in lua

I've looked the LuaFileSystem doc and didn't really understood how I could create a temporary file and write in it. Also, I'm not sure exactly where I can find the temp file I create.. In /tmp? Here's how my function would look like: do function…
hy0shi
  • 271
  • 4
  • 12
5
votes
2 answers

Read file line by line into array

sorry i am still learning about lua. could you correct me, why the data from file wont read line by line ? this is my example data in file points.txt : lexxo:30:1 rey:40:2 lion:40:2 prince:50:3 royal:50:3 so when i got from above is the 2d…
Han
  • 93
  • 1
  • 9
4
votes
1 answer

can not load luafilesystem in lua

when i load lfs module in lua file, i got the error message: error loading module 'lfs' from file '/usr/lib64/lua/5.1/lfs.so': /usr/lib64/lua/5.1/lfs.so:1: unexpected symbol near 'char(127)' here is the code: #!/usr/bin/lua package.path =…
jiafeng fu
  • 405
  • 1
  • 3
  • 12
3
votes
1 answer

Lua - require fallback / error handling

I'm currently using the awesome window manager on various Linux machines running different distributions. All of the machines utilize the same (lua) configuration file. Some of the machine have lua-filesystem (lfs) installed, while others don't. My…
Skeen
  • 4,614
  • 5
  • 41
  • 67
3
votes
1 answer

under lua, how can I if check file attributes only if the LuaFileSystem package is installed

I have some code which uses LuaFileSystem. However not all systems it will be run on have LuaFileSystem installed. I would like to check if it is installed, and only run the code if it is. Something like this (but this fails and states lfs is a null…
David
  • 151
  • 1
  • 11
2
votes
1 answer

How to compile LuaFileSystem library and get .dll file WITHOUT luarocks?

So, I got file "lfs.c" "lfs.h" "lfs.def" and ".gitignore". I tried installing MinGW and typing in that command: gcc lfs.c (Keep in mind that I'm a total newbie in such things), which leaves me with error "failed to include lua.h"... I don't know how…
user3426112
  • 401
  • 1
  • 3
  • 11
2
votes
1 answer

Building luafilesystem for Lua for Windows

I haven't a clue when it comes to building makefiles - I am trying to build luafilesystem in Windows 7 x86 for use with Lua for Windows. I have scoured the internet for tutorials but I just can't figure it out. I got as far as to run NMAKE in the…
1
vote
2 answers

Error in Lua: attempt to use a closed file. when using io.close() after reading files

I am learning Lua with youtube video and it introduces a way to write a text file like this: io.output("myfile.txt") print("My name is David") -- This won't write into the file, just print to the console io.write("hello world, how are…
yzrtt22
  • 13
  • 3
1
vote
0 answers

How to open a temporary file in a browser with Lua?

I'm currently working on a plugin for NeoVim in which I parse HTML from the current buffer and write it on a temporary file. Now, I want to open the temporary file in the browser, so it would show the result of the parsed HTML, but I can't get it…
1
vote
1 answer

Skipping current directory and previous directory using luafilesystem dir iterator

In LuaFileSystem, lfs.dir() iterates over the contents of a directory as strings. If I wanted to print the attributes of the contents of a directory, I might do it like this (using inspect.lua to print a human readable table…
ms4000kb
  • 73
  • 7
1
vote
1 answer

lua array contains specific value for checking further

sorry if i am bothering you now, i am still learning. but i need help. could you correct me and script how to check and then get value of array 2d for checking further and counting points ? example array2d syntax that i build : role =…
Han
  • 93
  • 1
  • 9
1
vote
0 answers

Installing luafilesystem errors

I want to install luafilesystem by luarocks, and now I have installed luarocks and Visual Studio 2015. When I invoke commond:luarocks it install luafilesystem, but there are some errors. The error is: C:\Users\basic>luarocks install…
basic_wang
  • 31
  • 3
1
vote
1 answer

Keep Lua tmpfile after execute

Uploades file represented as tmpfile() and will be removed then script exits. How to hardlink this file to keep its content after removing tmpfile? How to get name of file by its handle? > a=io.tmpfile() > print(a) file (0x20c8790) >…
eri
  • 3,133
  • 1
  • 23
  • 35
1
vote
1 answer

How to load Lua-Filesystem and Lua-Penlight in Luaj

I have a program using the Luaj 3.0 libraries and I found some lua scripts I want to include, but they all require lua file system and penlight and whenever I try to use those libraries, it gives an error. Does anyone know how I am supposed to make…
Thomas
  • 871
  • 2
  • 8
  • 21
1
vote
2 answers

Deleting All Files from system.DocumentsDirectory in corona

I am new to corona and want to add a functionality in my app that on pressing back button, all data stored by the user get deleted from the documents directory. In short I want to know is there a way to empty documents directory?
aneela
  • 1,457
  • 3
  • 24
  • 45
1
2