johnae / spook

Lightweight programmable evented utility based on LuaJIT and ljsyscall
Other
35 stars 0 forks source link

Cannot reference globals inside on_changed handlers. #43

Closed johnae closed 7 years ago

johnae commented 7 years ago

This can be somewhat surprising I think. Instead of requiring everyone to make locals of all global things in their Spookfiles I believe it's better to just setfenv on the given functions so globals are available. They are already available in the function given to "watch" and the other handlers (timer, signal etc). Doesn't make sense that they're not also available in the actual change handlers.

johnae commented 7 years ago

Fixed as of: https://github.com/johnae/spook/commit/9df7dba8855dafc7a345d6fe9b1af3bb50d5b1f5