Expose selection size description to lua
This commit is contained in:
14
src/nhlsel.c
14
src/nhlsel.c
@@ -33,6 +33,7 @@ staticfn int l_selection_circle(lua_State *);
|
||||
staticfn int l_selection_ellipse(lua_State *);
|
||||
staticfn int l_selection_gradient(lua_State *);
|
||||
staticfn int l_selection_iterate(lua_State *);
|
||||
staticfn int l_selection_size_description(lua_State *L);
|
||||
staticfn int l_selection_gc(lua_State *);
|
||||
staticfn int l_selection_not(lua_State *);
|
||||
staticfn int l_selection_and(lua_State *);
|
||||
@@ -949,6 +950,18 @@ l_selection_iterate(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* local txt = sel:describe_size(); */
|
||||
/* gives a textual description of the selection size */
|
||||
staticfn int
|
||||
l_selection_size_description(lua_State *L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
struct selectionvar *sel = l_selection_check(L, 1);
|
||||
char buf[BUFSZ];
|
||||
|
||||
lua_pushstring(L, selection_size_description(sel, buf));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const struct luaL_Reg l_selection_methods[] = {
|
||||
{ "new", l_selection_new },
|
||||
@@ -974,6 +987,7 @@ static const struct luaL_Reg l_selection_methods[] = {
|
||||
{ "iterate", l_selection_iterate },
|
||||
{ "bounds", l_selection_getbounds },
|
||||
{ "room", l_selection_room },
|
||||
{ "describe_size", l_selection_size_description },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user