lua-users home
lua-l archive

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


Am 25.11.2012 um 11:22 schrieb chuang <lichuang1982@gmail.com>:

> I want to write a C module,when Lua call this module's spawn function,it create a new Lua state,and the new Lua state can call its Lua function,like this:
> 
> require("qnode")
> 
> function test(a)
>   print("in test")
>   print(a)
> end
> 
> qnode.spawn(test, 100)
> 
> but,when i review the Lua C API,seems there is no function to get the Lua function from the Lua stack.
> So,how can I achieve this  purpose?
> 
> 

You could look at the proxy module:

https://github.com/mbalmer/luaproxy

maybe not 100% what you want, but maybe close.