wu-lang / wu

🐉 A practical game and data language
https://wu-lang.gitbook.io/guide/
MIT License
467 stars 17 forks source link

iter() doesnt works/exists #41

Open darltrash opened 3 years ago

darltrash commented 3 years ago

As said in the title. iter() doesnt works.

conte := ["undertale", "underale"]
for x in iter(conte) {
    std print(conte)
}

Returns:

wrong: can't seem to find `iter`
     --> ./definitions.wu
      │
   32 │ for x in iter(conte) {
      │          ^^^^
nilq commented 3 years ago

Thank you for opening an issue!

Having something like an iter iterator would be great. Currently there are ipairs and pairs, like in vanilla Lua:

list := [1, 2, 3, 3]

for x, y in ipairs(list) {
    print(x, y)
}

I won't close the issue, and will implement iter ASAP. Also, you don't need to use std print; just referencing print will do the job.