lua-users home
lua-l archive

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


>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