Skip to content

Instantly share code, notes, and snippets.

@bion
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save bion/4121b868973edd8104d5 to your computer and use it in GitHub Desktop.

Select an option

Save bion/4121b868973edd8104d5 to your computer and use it in GitHub Desktop.
scbeef
// should load all the files in a given dir, and then return an
// event (basically a dictionary) with keys as filenames and
// values as whatever the loaded file returned.
// in this case, each file returns a lambda that takes two args
var gestureLibrary = ~dirToEvent.value(~baseDir ++ "/gestures");
// actually returns an empty event because the sclang interpreter
// is easily confused about its pwd
gestureLibrary.postln; // => ( )
// then later i try to use it...
gestureLibrary[gesture.action].value(offset, gesture); // fails silently
// okay, so events return nil when the key isn't present, fine
// but nil responds to .value (the lambda invocation method)
// and, of course, cares nothing about whatever args are passed to it
a = ();
a[\foo]; // => nil
a[\foo].value(1, 2, 4); // => nil and no error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment