lua-users home
lua-l archive

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


What are you talking about? I cannot pass this return value to a variable
and typecast into whatever I want? I guess this is the evil!!

Like:

I have this
void figureout(char *what, int ever)

and I must his 2 args came from lua. Im trying to do this:

int serial(lua_State *L) //my registered function
    {
        int argc = lua_gettop(L);
        const char var1 = lua_tostring(L, 1);
        int var2 = int(lua_tonumber(L, 2));
        figureout(var1, var2);
        return 0;
    }

There is another way? I can't see that way, and that is my problem.


-----Mensagem original-----
De: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] Em nome de Rici Lake
Enviada em: segunda-feira, 2 de julho de 2007 17:58
Para: Lua list
Assunto: Re: RES: C++ Typecast - so far newbie question


On 2-Jul-07, at 2:40 PM, SosCpdTerra wrote:

> Did someone know a better way to typecast a const char * (that is about
> lua_tostring(L, n)) into a char * then vector or c_str()? I'm fighting 
> with
> that...

Strings returned by lua_tostring *must not be modified*.

So don't cast them to char* or evil things will happen.



__________ NOD32 2371 (20070702) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com