miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 09 Oct 2012 03:59 PM |
Can someone explain to me what a macro is and an example? I looked it up and said
"a macro definition defines how to expand a single language statement or computer instruction into a number of instructions."
But from that sentence that makes me think it's just a function and when you call that function it's that single statement.
Thanks again guys. |
|
|
| Report Abuse |
|
|
|
| 09 Oct 2012 04:10 PM |
It's just a function
function macro() doLotsOfStuff() end
macro() --single statement which does more stuff |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 09 Oct 2012 04:12 PM |
That's what I thought from reading the definition. But wasn't sure because none of you guys nor scripting helpers really talk about it.
Well thanks, brandon. |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 09 Oct 2012 04:25 PM |
Lua doesn't really have macros. However, things like C do. This is an example of what only a macro can do:
#define until(x) while(!(x))
int x = 10; until(x == 0) { x--; } |
|
|
| Report Abuse |
|
|
|
| 09 Oct 2012 04:59 PM |
| Oh the joys of C[++] macros |
|
|
| Report Abuse |
|
|