[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Replaced print function return stack getting emptied
- From: Bruce Wheaton <bruce@...>
- Date: Sun, 6 May 2012 12:38:09 -0700
On May 6, 2012, at 11:22 AM, Steven Johnson wrote:
> If I'm not mistaken, you're actually seeing the return values for the
> loadstring() chunk, not your print function.
I'm confused then. My loadString chunk is, for instance: print ("hello")
If I enter: return ("hello") then the stack does have a string - hello on it.
How do I call a C function and get return results if that doesn't work?
> Assuming your user code is very simple, you could do
> return print("stuff", "more stuff")
I'd rather not tell the user they can't just type 'print'. That seems odd to me.
> on the console or prepend a "return " to inCmd before loading.
Then to everything the user types, so I get the return value? If that were a lua restriction, it seems like it would be mentioned.
> For something more general maybe print could stuff the strings into a
> table in parallel and you can snag that instead.
As a workaround, I see what you mean. But not being able to get return values is confusing me. It feels like I'm doing something wrong. If 'return "hello"' works, it feels like a C function that returns values should too.