Mercurial Hosting > luan
diff core/src/luan/modules/Io.luan @ 392:8668f3799ad9 0.5
add Io.dont_write_when_no
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 24 Apr 2015 14:16:03 -0600 |
parents | 7f7708e8fdd4 |
children | 62b457c50594 |
line wrap: on
line diff
--- a/core/src/luan/modules/Io.luan Fri Apr 24 14:05:52 2015 -0600 +++ b/core/src/luan/modules/Io.luan Fri Apr 24 14:16:03 2015 -0600 @@ -32,3 +32,19 @@ function print(...) print_to(stdout,...) end + + +-- useful for SimplyHTML responsiveness + +NO = {} + +function dont_write_when_no(write_fn) + return function(...) + for v in Luan.values(...) do + if v == NO then + return + end + end + write_fn(...) + end +end