Nicksf13 / zombieplague

Garry's mod Gamemode
MIT License
9 stars 9 forks source link

Use ipairs instead of pairs for index tables #290

Closed Bilwin closed 2 years ago

Bilwin commented 2 years ago

https://gitspartv.github.io/LuaJIT-Benchmarks/#test10

Nicksf13 commented 2 years ago

Is there any reason for that? Or it's just good programming practices?

Bilwin commented 2 years ago

I was relying on the efficiency of both functions to search the index (key) and the value. You can see the efficiency of the functions in the link attached to the PR, some Just-In-Time things are also tied to the linting of Lua 5.1

Also this is the right choice of parsing, since in the code we're working with index tables, not ["key"] = "like"

Nicksf13 commented 2 years ago

Ok, I didn't know that. Thank you Bilwin!