Jump to content




[solved]saving an information file to parent directory?


  • You cannot reply to this topic
2 replies to this topic

#1 CreeperGoBoom

  • Members
  • 91 posts

Posted 06 May 2014 - 04:06 AM

ok, i am thinking of writing a few programs which will act as server pcs allowing for easy internetwork communication between the computers added to said network, would even allow me to install a particular program just by choosing a particular network name, only thing is ive hit a hurdle

this is on a multiplayer server, a close friend of mines

i created a test,txt file, then attempted to get the parent directory of the file i just created, attempting to use the fs.getDir("test.txt") (this is the exact file name

instead i got attempt to call nil, the wiki page isnt much help on this, how would i return the directory of path when path is unknown??

Quote

Function fs.getDir
Returns the parent directory of path. This is the directory a file/folder is in.

if anyone has any ideas that would be appreciated, seems im trying to use the wrong method

also ive only just started reading Programming in Lua, i'm reasonably new to lua, but i can learn quick off code examples :)

edit: i want to know how to get the parent directory above the id folder of the computer (eg: saves/computer/ not saves/computer/<id>)

Edited by CreeperGoBoom, 06 May 2014 - 04:44 AM.


#2 CometWolf

  • Members
  • 1,283 posts

Posted 06 May 2014 - 04:23 AM

fs.getDir was added in 1.6, and in the case of a file in the root folder, it would probably just return "/". It simply removes the last file name from the given path. There is no way to acess anything above the root folder from in-game.

#3 CreeperGoBoom

  • Members
  • 91 posts

Posted 06 May 2014 - 04:44 AM

ok thanks :) looks like i was trying to do the whole server thing wrong





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users