Mercurial Hosting > luan
diff src/luan/modules/ThreadLuan.java @ 1420:225808b90cee
options handling
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 26 Oct 2019 22:21:09 -0600 |
parents | 5b8f76e26ab7 |
children | 67bed466460e |
line wrap: on
line diff
--- a/src/luan/modules/ThreadLuan.java Fri Oct 25 22:12:06 2019 -0600 +++ b/src/luan/modules/ThreadLuan.java Sat Oct 26 22:21:09 2019 -0600 @@ -57,15 +57,15 @@ public static void schedule(LuanFunction fn,LuanTable options) throws LuanException { - Map map = options.asMap(); - Number delay = Utils.removeNumber(map,"delay"); - Number repeatingDelay = Utils.removeNumber(map,"repeating_delay"); - Number repeatingRate = Utils.removeNumber(map,"repeating_rate"); - String id = Utils.removeString(map,"id"); + options = new LuanTable(options); + Number delay = Utils.removeNumber(options,"delay"); + Number repeatingDelay = Utils.removeNumber(options,"repeating_delay"); + Number repeatingRate = Utils.removeNumber(options,"repeating_rate"); + String id = Utils.removeString(options,"id"); if( repeatingDelay!=null && repeatingRate!=null ) throw new LuanException("can't define both repeating_delay and repeating_rate"); boolean repeating = repeatingDelay!=null || repeatingRate!=null; - Utils.checkEmpty(map); + Utils.checkEmpty(options); if( id != null ) { Reference<ScheduledFuture> ref = scheduleds.remove(id); if( ref != null ) {