Add a locale-independent float/double format Lua method
print(ARDOUR.LuaAPI.ascii_dtostr(1.5))
This commit is contained in:
parent
6434bf9dd3
commit
d9a3866299
@ -187,6 +187,10 @@ namespace ARDOUR { namespace LuaAPI {
|
||||
*/
|
||||
int color_to_rgba (lua_State *lua);
|
||||
|
||||
/**
|
||||
*/
|
||||
std::string ascii_dtostr (const double d);
|
||||
|
||||
/**
|
||||
* Creates a filename from a series of elements using the correct separator for filenames.
|
||||
*
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -2330,6 +2330,7 @@ LuaBindings::common (lua_State* L)
|
||||
.addCFunction ("plugin_automation", ARDOUR::LuaAPI::plugin_automation)
|
||||
.addCFunction ("hsla_to_rgba", ARDOUR::LuaAPI::hsla_to_rgba)
|
||||
.addCFunction ("color_to_rgba", ARDOUR::LuaAPI::color_to_rgba)
|
||||
.addFunction ("ascii_dtostr", ARDOUR::LuaAPI::ascii_dtostr)
|
||||
.addFunction ("usleep", Glib::usleep)
|
||||
.addFunction ("monotonic_time", ::g_get_monotonic_time)
|
||||
.addCFunction ("build_filename", ARDOUR::LuaAPI::build_filename)
|
||||
|
Loading…
Reference in New Issue
Block a user