[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: lstring expansion from the c side
- From: Jim Mathies <Jim@...>
- Date: Wed, 31 May 2000 14:52:28 -0400
Ok, well, what i'd like to do is this:
lua_Object lo = tolua_getobject( ParamOne, 0 );
and assuming Param One is a string -
I'd like to check the strlen and get the data if
there is any:
size = lua_strlen( lo );
lstr = lua_getstring( lo );
from here, i can recreate a new string with the contents of
lstr plus any data I wish to add to it. (say lstr is at
first an empty lstring.)
But I can't seem to get this data back into lstr, so
that a call like this would return the new buffer in the
success/failure func( buffer, size )
My biggest concern here is being fast, I'd rather
not invoke any tag methods or have to create new strings
I'd just like a simple:
lua_expandlstring( lo, newbuffersize )
..so I can get the lstr buffer pointer and copy new (sometimes
larger) data chunks into it.
From: Luiz Henrique de Figueiredo [mailto:firstname.lastname@example.org]
Sent: Wednesday, May 31, 2000 5:35 AM
To: Multiple recipients of list
Subject: Re: lstring expansion from the c side
>From email@example.com Tue May 30 15:44:16 2000
>From: Jim Mathies <Jim@mathies.com>
>What is the simplest and fastest way to
>expand the size of the buffer used to
>store a lua lstring, from the c side?
>assuming I have the string object.
I'm sorry, I don't quite understand what you want to do.
There's no way to change individual bytes inside a Lua string -- you
create another string.
So, if you want to edit a string, just do it in C (say, by changing
individual bytes or by appending something to it), and then send this
to Lua, using lua_pushlstring.
Perhaps I'm missing something.