Operators - Getting back into lua.

Hello Facepunch,

After a long year I’ve decided to get myself back into lua, although I’m a little rusty. If someone would be willing to set me challenges I’d really apprecaite that, but I don’t like to be spoon fed.
At the minute I’m having an issue of what on understanding of ‘#’ is.

if a and #a == 2 then … return end.

If someone could show me a few example of how you’ve used this I’d appreciate it a lot, thank you.


[lua]print(#{1, 1, 1, 1})[/lua]

  1. Learn how to google
  2. Check addons/gits for code examples
  3. Always check wiki.garrysmod.com
  4. This thread is a spoonfeed

Much appreciated. So it basically in your first example returns the string characters and the seconf it;ll retrund how many indexes in a table I’m sure.

Thank you!

Only the table’s array part. See the link in the post you quoted for more info.

Challenges are here: http://forum.facepunch.com/showthread.php?t=1487912