write = term and term.write
What does this syntax do?
Thanks in advance and I hope you can help me.
~Creator
Posted 16 March 2015 - 05:07 PM
write = term and term.write
Posted 16 March 2015 - 05:10 PM
Posted 16 March 2015 - 05:15 PM
if term then write=term.write endthe reason they would not simply do write=term.write is because if term is not a table then trying to access term.write would throw back an error.(however it should be write = type(term)=="table" and term.write, however if term does exist it should be a table, unless someone redefined it.
Posted 16 March 2015 - 05:18 PM
a = a or 123
a = condition and something or anotheris similar C's
a = condition ? something : anotherIf something is nil or false it will break
Edited by SquidDev, 16 March 2015 - 05:20 PM.
Posted 16 March 2015 - 05:27 PM
Posted 16 March 2015 - 06:18 PM
0 members, 1 guests, 0 anonymous users