[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: calling from C to Lua to C and back to Lua?
- From: Markus Klotzbuecher <markus.klotzbuecher@...>
- Date: Fri, 27 Apr 2012 14:32:28 +0200
On Thu, Apr 26, 2012 at 12:14:56PM -0300, Roberto Ierusalimschy wrote:
> > Calling from C into Lua (using pcall), which in turn calls a C
> > function that then calls back into the same Lua (pcall again)?
>
> Yes. This is quite common in Lua. For instance:
>
> table.sort(t, function (a,b) return a.x < b.x end)
>
> When you run this script, the stand-alone C interpreter calls Lua (to
> run the main chunk) that calls C (table.sort) which calls Lua
> (the user-provided order function).
Perfect, thanks!
Markus