Re: Impossible call 'patch' inside onkeydown handler?
Status: Alpha
Brought to you by:
cwalther
From: Christian W. <cwa...@gm...> - 2008-01-29 20:59:21
|
Andrea Viarengo wrote: > onkeydown ( > function(key) > p_ref=patch{nx=1,ny=1,nz=0,nw=1,nh=1,angley=90,image="left.png"} > return false > end > ) > -------------------------------------------------------------- > > When you press a key, you will get the message: > > Error running local keydown handler: > 1/node.lua:13: attempt to call global 'patch' (a nil value) This is by design. "patch" is only available at node loading time, not as a run-time function. You should not think of it as a function (even though it technically is one), but as part of a declarative node description syntax. > if I substitute patch with pipmak_internal.patch, it seems to work fine, > for this simple example, > but using a more complex code, Pipmak crash in that point... You're not supposed to use pipmak_internal. It's called internal for a reason... We should probably make sure that you can't crash Pipmak even if you do, but that looks quite tedious... :/ > Is it a problem of my build, or really I cannot define a new patch inside > a keydown handler? You can't create patches at run time. What would you need that for? Would it be very inconvenient to have to reload the node for it? -Christian |