Mercurial Hosting > luan
changeset 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 | 2f5cc9c2cbf0 |
children | c46eced6a060 |
files | core/src/luan/modules/Io.luan |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
diff -r 2f5cc9c2cbf0 -r 8668f3799ad9 core/src/luan/modules/Io.luan --- 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