stdlib.lua 301 B

12345678910111213141516
  1. function range(i, j)
  2. local function rangeGenerator()
  3. while i < j do
  4. coroutine.yield(i)
  5. i = i + 1
  6. end
  7. end
  8. return coroutine.wrap(rangeGenerator)
  9. end
  10. -- cross-platform file rename
  11. function rename(src, dest)
  12. os.remove(dest)
  13. return os.rename(src, dest)
  14. end