[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Comparing 2 strings
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 24 Jun 2003 09:40:43 -0300
>Is it possible to compare two strings which are already in lua (on top
>of the stack preferably), using the C interface? Or do i have to load
>them into C buffers?
How do you want to compare them? Here are a few possibilities:
- strcmp(lua_tostring(L,-1),lua_tostring(L,-2))
- lua_equal(L,-1,-2)
- lua_lessthan(L,-1,-1)
Note that in the first case there is no need to copy the strings to C buffers.
--lhf