jbe/bsw@0: --[[-- jbe/bsw@0: path = -- string containing a (file) path jbe/bsw@0: encode.concat_file_path( jbe/bsw@0: element1, -- first part of the path jbe/bsw@0: element2, -- second part of the path jbe/bsw@0: ... -- more parts of the path jbe/bsw@0: ) jbe/bsw@0: jbe/bsw@0: This function takes a variable amount of strings as arguments and returns a concatenation with slashes as seperators. Multiple slashes following each other directly are transformed into a single slash. jbe/bsw@0: jbe/bsw@0: --]]-- jbe/bsw@0: jbe/bsw@0: function encode.concat_file_path(...) jbe/bsw@0: return ( jbe/bsw@0: string.gsub( jbe/bsw@0: table.concat({...}, "/"), "/+", "/" jbe/bsw@0: ) jbe/bsw@0: ) jbe/bsw@0: end