diff options
author | Robin Gareus <robin@gareus.org> | 2018-08-14 23:49:43 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-08-14 23:50:11 +0200 |
commit | d9a3866299bc43c5139e8812ba8c2dbfc4ece343 (patch) | |
tree | 24b1cfea0a4b0c1bbb45e4cb496e0e48fcbbd6c1 /libs/ardour/lua_api.cc | |
parent | 6434bf9dd34c3b32f6ba41f668562af0ae740c8a (diff) |
Add a locale-independent float/double format Lua method
print(ARDOUR.LuaAPI.ascii_dtostr(1.5))
Diffstat (limited to 'libs/ardour/lua_api.cc')
-rw-r--r-- | libs/ardour/lua_api.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/ardour/lua_api.cc b/libs/ardour/lua_api.cc index 59d2749399..82ff2fd651 100644 --- a/libs/ardour/lua_api.cc +++ b/libs/ardour/lua_api.cc @@ -527,6 +527,14 @@ ARDOUR::LuaAPI::hsla_to_rgba (lua_State *L) return 4; } +std::string +ARDOUR::LuaAPI::ascii_dtostr (const double d) +{ + gchar buf[G_ASCII_DTOSTR_BUF_SIZE]; + g_ascii_dtostr (buf, sizeof(buf), d); + return std::string (buf); +} + int ARDOUR::LuaAPI::color_to_rgba (lua_State *L) { |