Master_MTA Posted August 23, 2017 Share Posted August 23, 2017 hey how i can create directory in lua? Link to comment
Administrators Lpsd Posted August 23, 2017 Administrators Share Posted August 23, 2017 https://wiki.multitheftauto.com/wiki/FileCreate fileCreate You need to create a file along with it, but that will create directory if it doesn't exist, ie fileCreate("directory/file.lua") Link to comment
Master_MTA Posted August 23, 2017 Author Share Posted August 23, 2017 8 minutes ago, LopSided_ said: need if i wasn't wrong you can check that filePath: The filepath of the file to be created in the following format: ":resourceName/path". 'resourceName' is the name of the resource the file is in, and 'path' is the path from the root directory of the resource to the file. i tested it before and it doesn't work that wasn't my mean i mean i wanna create folder out side the resource Link to comment
Administrators Lpsd Posted August 23, 2017 Administrators Share Posted August 23, 2017 (edited) Well, that wasn't what you asked for You can create a folder in another resource, by doing fileCreate(":resourceName/path/file.lua") Some examples of your code would help, too Edited August 23, 2017 by LopSided_ Link to comment
Master_MTA Posted August 23, 2017 Author Share Posted August 23, 2017 3 minutes ago, LopSided_ said: Well, that wasn't what you asked for You can create a folder in another resource, by doing fileCreate(":resourceName/path/file.lua") Some examples of your code would help, too i wasn't mean that also i was mean i wanna create folder out side all resource i wanna create folder in mods or resource-chahe does it possible? Link to comment
Administrators Lpsd Posted August 23, 2017 Administrators Share Posted August 23, 2017 It's not possible without creating your own server module (I think) Just out of interest why would you need to create a folder there? 1 Link to comment
Master_MTA Posted August 23, 2017 Author Share Posted August 23, 2017 (edited) 2 minutes ago, LopSided_ said: It's not possible without creating your own server module (I think) Just out of interest why would you need to create a folder there? i want to create a script which it will make you able to take backup of your resources +_+ nice idea right? Edited August 23, 2017 by Master_MTA Link to comment
Administrators Lpsd Posted August 23, 2017 Administrators Share Posted August 23, 2017 Take a look at https://wiki.multitheftauto.com/wiki/Modules/FileSystem - I haven't used it myself so can't say whether it works or not. 1 Link to comment
Master_MTA Posted August 23, 2017 Author Share Posted August 23, 2017 3 minutes ago, LopSided_ said: Take a look at https://wiki.multitheftauto.com/wiki/Modules/FileSystem - I haven't used it myself so can't say whether it works or not. thx a lot that's great Link to comment
Administrators Lpsd Posted August 23, 2017 Administrators Share Posted August 23, 2017 No problem. Good luck Link to comment
Master_MTA Posted August 23, 2017 Author Share Posted August 23, 2017 Just now, LopSided_ said: No problem. Good luck thx but the download link doesn't work? Link to comment
Administrators Lpsd Posted August 23, 2017 Administrators Share Posted August 23, 2017 Not sure, it might be outdated. Don't know too much about it if I'm being honest Link to comment
Master_MTA Posted August 24, 2017 Author Share Posted August 24, 2017 7 hours ago, LopSided_ said: Not sure, it might be outdated. Don't know too much about it if I'm being honest thx i am created my own function function copyResourceIntoResource(res,tores) local ta={} local conf=xmlLoadFile( ':'..res..'/meta.xml' ) local cildren=xmlNodeGetChildren(conf) local function isreg(value,msr) if #msr==0 then return false end for l,c in pairs(msr) do if c==value or (#split(c,',')>1 and split(c,',')[1]==value) then return l end end return false end for k=1,#cildren do local name=xmlNodeGetName(cildren[k]) local jj=isreg(name,ta) if jj~=false then ta[jj]=ta[jj]..','..name else table.insert(ta,name) end end fileCopy(':'..res..'/'..'meta.xml', tores..'/'..res.."/meta.xml") for k,v in pairs(ta)do local spl=#split(v,',') for m=0,spl-1 do local chil=xmlFindChild (conf,split(v,',')[1],m) local at=xmlNodeGetAttribute(chil,'src') if at then fileCopy(':'..res..'/'..at, tores..'/'..res.."/"..at) if #ta==k then xmlUnloadFile(conf) return true end end end end return false end Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now