Skip to content

Commit 53f0342

Browse files
committed
expose canvas_realizedollar()
1 parent 4c8c8b6 commit 53f0342

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

pd.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,10 @@ function pd.Class:set_args(args)
453453
pd._set_args(self._object, args)
454454
end
455455

456+
function pd.Class:canvas_realizedollar(s)
457+
return pd._canvas_realizedollar(self._object, s)
458+
end
459+
456460
function pd.Class:repaint()
457461
if type(self.paint) == "function" then
458462
local g = _gfx_internal.start_paint(self._object);

pdlua.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2490,6 +2490,23 @@ static int pdlua_dofile(lua_State *L)
24902490
return lua_gettop(L) - n;
24912491
}
24922492

2493+
static int pdlua_canvas_realizedollar(lua_State *L)
2494+
{
2495+
if (lua_islightuserdata(L, 1) && lua_isstring(L, 2))
2496+
{
2497+
t_pdlua *o = lua_touserdata(L, 1);
2498+
if (o && o->canvas)
2499+
{
2500+
const char *sym_name = lua_tostring(L, 2);
2501+
t_symbol *s = gensym(sym_name);
2502+
t_symbol *result = canvas_realizedollar(o->canvas, s);
2503+
lua_pushstring(L, result->s_name);
2504+
return 1;
2505+
}
2506+
}
2507+
return 0;
2508+
}
2509+
24932510
/** Initialize the pd API for Lua. */
24942511
static void pdlua_init(lua_State *L)
24952512
/**< Lua interpreter state. */
@@ -2585,6 +2602,9 @@ static void pdlua_init(lua_State *L)
25852602
lua_pushstring(L, "_set_args");
25862603
lua_pushcfunction(L, pdlua_set_arguments);
25872604
lua_settable(L, -3);
2605+
lua_pushstring(L, "_canvas_realizedollar");
2606+
lua_pushcfunction(L, pdlua_canvas_realizedollar);
2607+
lua_settable(L, -3);
25882608
lua_pushstring(L, "_error");
25892609
lua_pushcfunction(L, pdlua_error);
25902610
lua_settable(L, -3);

0 commit comments

Comments
 (0)