diff options
author | Robin Gareus <robin@gareus.org> | 2016-09-12 12:02:07 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-09-12 12:02:07 +0200 |
commit | 656b3b9c2862114eb84ea0eea5225568015515f5 (patch) | |
tree | d941406b6864a0f763eff0ac1442060582d60642 /libs/ardour/lua_api.cc | |
parent | 55af1d539f90ebafa2f598ddd5ab0cc1425263b6 (diff) |
Add a Lua wrapper to Glib::build_filename()
Diffstat (limited to 'libs/ardour/lua_api.cc')
-rw-r--r-- | libs/ardour/lua_api.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libs/ardour/lua_api.cc b/libs/ardour/lua_api.cc index 890e268c59..1cf403b8b0 100644 --- a/libs/ardour/lua_api.cc +++ b/libs/ardour/lua_api.cc @@ -346,6 +346,26 @@ ARDOUR::LuaAPI::hsla_to_rgba (lua_State *L) return 4; } +int +ARDOUR::LuaAPI::build_filename (lua_State *L) +{ + std::vector<std::string> elem; + int top = lua_gettop(L); + if (top < 1) { + return luaL_argerror (L, 1, "invalid number of arguments, build_filename (path, ...)"); + } + for (int i = 1; i <= top; ++i) { + int lt = lua_type (L, i); + if (lt != LUA_TSTRING) { + return luaL_argerror (L, i, "invalid argument type, expected string"); + } + elem.push_back (luaL_checkstring(L, i)); + } + + luabridge::Stack<std::string>::push (L, Glib::build_filename (elem)); + return 1; +} + luabridge::LuaRef::Proxy& luabridge::LuaRef::Proxy::clone_instance (const void* classkey, void* p) { lua_rawgeti (m_L, LUA_REGISTRYINDEX, m_tableRef); |