User Tools

Site Tools


Sidebar

box.space:triggers_replace

Q. I need to update box.space.myspace on_replace triggers on my module load.

How do I do it the right way? (2016)

A. on_replace takes two keys: new one and old one. If the old one is nil, it's a new trigger. If the new one is nil, it's deletion. If both keys are present, it's an update.

A function in Lua is a first-class object, so it works well as a key.

Comments

Enter your comment. Wiki syntax is allowed:
C W Y Y Y
 
box.space/triggers_replace.txt · Last modified: 2018/06/04 16:47 by eabates

Real Time Web Analytics