I have NEVER EVER known what pushStyle() or popStyle() OR return, even does. Please help, I need to know because I see it everywhere. When they say “pushes it onto the stack”, WHAT STACK?! The stack of code!? Ugh. facepalms himself
Oh and, I am learning ALOT of Lua now. I know more than ever before BTW
Where can I find them?
Check out the Wiki & Reference links at the top of the page
If you can English you understand return means
If you use for example in print a function
function p(v) return v end
so it prints “value”
@TokOut - that has nothing to do with the original question
Yay! I know what popStyle(), pushStyle() means/does! Still not return. I can’t find any help on return, can someone please give me a detailed example.
@LL_Phoenix456 - Read up about functions in Lua. There are dozens of web pages.
You can’t expect us to give you personal tuition on the simplest things that are explained already if you just look!
We are happy to help solve problems, but this is NOT a problem.
Hers a link to a Lua manual.
Here a section about break and return in that manual.
Previous Programming in Lua Next
Part I. The Language Chapter 4. Statements
4.4 – break and return
return statements allow us to jump out from an inner block.
You use the break statement to finish a loop. This statement breaks the inner loop (for, repeat, or while) that contains it; it cannot be used outside a loop. After the break, the program continues running from the point immediately after the broken loop.
A return statement returns occasional results from a function or simply finishes a function. There is an implicit return at the end of any function, so you do not need to use one if your function ends naturally, without returning any value.
For syntactic reasons, a break or return can appear only as the last statement of a block (in other words, as the last statement in your chunk or just before an end, an else, or an until). For instance, in the next example, break is the last statement of the then block.
local i = 1 while a[i] do if a[i] == v then break end i = i + 1 end
Usually, these are the places where we use these statements, because any other statement following them is unreachable. Sometimes, however, it may be useful to write a return (or a break) in the middle of a block; for instance, if you are debugging a function and want to avoid its execution. In such cases, you can use an explicit do block around the statement:
function foo ()
return --<< SYNTAX ERROR
– `return’ is the last statement in the next block
do return end – OK
… – statements not reached