lua-users home
lua-l archive

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

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 <> 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).