lua-users home
lua-l archive

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


No? Just lua_push "table", lua_gettable "table" from Global, lua_push
"sort", lua_gettable the function. lua_push the arguments and lua_call
it. Possible shortcuts using loadstring to retrieve the function
handle for you. You can also save the handle for the sort function in
the luaregistry for easier retrieval from then on. If you don't want
to use the built in sort, transcribing a standard the quicksort
pseudocode in yet another language is a finger exercise for every
semi-serious coder, albeit through the Lua C interface its going to be
a tad longer than one is used to. Gonna be interesting how a
custom-c-api-quicksort performs against the built-in sort having to
call the compare function all the time.

BTW: Why does the manual not describe which algorithm is used and how
it performs on sorted, unsorted, and reverse-sorted data?

On Wed, Aug 17, 2011 at 11:32 AM, Rebel Neurofog
<rebelneurofog@gmail.com> wrote:
>> Just call table.sort from C API?
>
> Do you really think, that it is funny?
>
> At least I have customizable API in my software.
> 'table' isn't there by default.
> I had to remove "tostring ()" dependency from "print ()" (why did they do this?)
>
>