lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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