Thing Posted November 10, 2012 Share Posted November 10, 2012 how to get all png files in folder (which is in another resource)?? and export it to gridlist? Link to comment
50p Posted November 10, 2012 Share Posted November 10, 2012 You can read the resource's meta.xml and get all the files from there. function getResourceAllFiles( resourceName ) local files = { }; local metaRoot = xmlLoadFile( ":" .. resourceName .. "/meta.xml" ); for i, node in ipairs( xmlNodeGetChildren( metaRoot ) ) do if( xmlNodeGetName( node ) == "file" then -- check if the node is table.insert( files, xmlNodeGetAttribute( node, "src" ) ); end end return files; end Haven't tested but it's a simple function which will return all 's from specified resource (this includes .mp3, .png and all other files included in resource as ). Once you get the list of files just loop through it and add it to gridlist. Link to comment
Castillo Posted November 10, 2012 Share Posted November 10, 2012 Show us how you used it. Link to comment
TAPL Posted November 10, 2012 Share Posted November 10, 2012 doesnt work I guess you use it client side, xmlLoadFile client side can load only the files that has downloaded in mods\deathmatch\resources, while meta.xml not one of them. You need to use it server side and trigger it to client side. Link to comment
Anderl Posted November 11, 2012 Share Posted November 11, 2012 You can try using modules to make a function to scan directories. 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