[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Cannot call lua function from C application
- From: "Yang Fan" <missdeer@...>
- Date: Tue, 1 Aug 2006 01:14:06 +0800
Thanks for replying.
The function "main" gets an argument, so we should push something into the virtual stack after lua_getglobal.
Maybe somewhere else makes things incorrect.
On 8/1/06, Ignacio Burgueño <ignacio@tecnolink.com.uy> wrote:
Yang Fan wrote:
> /* push functions and arguments */
> lua_getglobal(L, "main"); /* function to be called */
> lua_pushlstring(L, m_data.c_str(), m_data.size());
>
> /* do the call (1 arguments, 0 result) */
>
> error msg showed:Error running function "main": attempt to call a
> string value
>
I think that the line after lua_getglobal is not necessary. You already
have the function on the stack (given that lua_getglobal succeeded).