zizroc/villager

Add support for variadic parameters in add_resource & add_winik

Closed this issue · 0 comments

It's kind of messy having to call add_resource and add_winik over and over again. We should take advantage of R's ellipsis functionality to fix this.

For example,

  apples  <- resource$new("apple", 5)
  oranges <- resource$new("orange", 10)
  cabbage <- resource$new("cabbage", 20)

  resource_mgr$add_resource(apples)
  resource_mgr$add_resource(oranges)
  resource_mgr$add_resource(cabbage)

should be able to be written as

  apples  <- resource$new("apple", 5)
  oranges <- resource$new("orange", 10)
  cabbage <- resource$new("cabbage", 20)

  resource_mgr$add_resource(apples, oranges, cabbage)