Thread Tools Display Modes
Prev Previous Post   Next Post Next
04/24/16, 12:43 PM   #1
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,586
Crashes with table.sort

I always thought it was normal that eso crashes if I mess up my sort function in some bad way, but now that haggen had a similar problem I went to the trouble of actually reading the Lua source code and saw that it should not happen that way.

Lua Code:
  1. local myTable = {1,2,3,4}
  2. table.sort(myTable, function(a, b)
  3.    return true
  4. end)

This should throw a Lua error according to the source code of auxsort, but instead it becomes an infinite loop and hangs the process until it is killed.

I suspect it has to do with this piece here:
Code:
   /* repeat ++i until a[i] >= P */
      while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) {
        if (i>u) luaL_error(L, "invalid order function for sorting");
        lua_pop(L, 1);  /* remove a[i] */
      }
For some reason luaL_error does not get fired or simply does not stop code execution.
  Reply With Quote
 

ESOUI » Developer Discussions » General Authoring Discussion » Crashes with table.sort


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off