User Tag List

Page 6 of 43 FirstFirst ... 4 5 6 7 8 16 ... LastLast
Results 51 to 60 of 426

Thread: XLua extention beta

  1. #51
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    Ok, so unless I'm mistaken, there are two scenarios:

    Either it could create a bad reference and would instantly segfault, which it is not doing (that should be really obvious if it was going on), or it could just be not freeing up the pointers to old objects *UNTIL* they are overwritten. But in this latter case, I'm never using up more than my *max number of objects* pointers, because I'm making sure to overwrite with unused ID's instead of simply assigning new ones over and over again. (it does indeed crash the instant I create my 1001th object, but this could be for any number of reasons; its trying to access an out-of-bounds array on both sides of MMF/XLua. But the 1000 object limit is an intentional design restriction I'm going to work around, I just set it that high arbitrarily)

    I suppose this means that if someone wasn't careful enough to do that and assigned new ID's to every object exported sequentially, it would eventually cause a dangerous memory leak. But for my project, it looks like you did a spiffy job and the code should run clean

  2. #52
    Clicker Multimedia Fusion 2
    Retriever2's Avatar
    Join Date
    Jun 2006
    Location
    United States
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    If it's crashing after 1000 objects, then that's a bug that should really be fixed. I haven't seen it myself. Send me an example if you have one.

    I did some testing, creating and destroying tens of thousands of objects per second. Whether I was exporting to the same ID, a unique ID, or not exporting at all, seemed to make no difference. Now I imagine there is probably some kind of leak, but it's not going to accumulate to anything appreciable even under the worst conditions.

  3. #53
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    Well no I mean the way I set it up, I imposed an object limit of 1000 objects, so any more than that SHOULD crash it; theres a 3 dimensional array that stores object data inside my Lua script, and when a 1001th object is exported, it will be doing all sorts of bad things; it will be attempting to read/write from outside of array boundaries in Lua, running an infinite loop in MMF as it tries to locate the next available ID spot (it would just keep cycling from 1 to 1000 and back infinitely), writing out of bounds of a magicdeque, etc. So thats not a defect, at all

  4. #54
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    by the way, I did encounter one thing that concerned me about it, but I think its a Lua problem, not xLua. I wanted to write to a 3 dimensional array like this:

    function updateObject(timeStep,id)
    timeArray[timeStep][id] = {};
    timeArray[timeStep][id]["X"] = mmf.Object.GetX(id);
    end

    but it simply doesn't work. I eventually found out that it wasn't letting me pass in the first two variables in a 3 dimensional table call; the X/Y in a [x][y][z] don't work. But for some blasted reason, it lets me pass a loop ticker, like this:

    function updateObject(timeStep,id)
    for i=timeStep,timeStep do
    for j=id,id do
    timeArray[i][j] = {};
    timeArray[i][j]["X"] = mmf.Object.GetX(id);
    end
    end
    end


    any idea why the heck that would be happening? Its like Lua only allows the 'last' input to a table reference


  5. #55
    Clicker Multimedia Fusion 2
    Retriever2's Avatar
    Join Date
    Jun 2006
    Location
    United States
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    Well I ran the following code in the lua.org online interpreter, and on xlua, and they both ran fine:

    arr = {}
    for i = 1, 5 do
    arr[i] = {}
    for j = 1, 5 do
    arr[i][j] = {}
    for k = 1, 5 do
    arr[i][j][k] = i * j * k
    end
    end
    end

    x = 2
    y = 4
    z = 3

    print(arr[x][y][z])

    I'm not sure what's happening in your code.

  6. #56
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    the problem is that its only letting me set those [x][y] variables with loop indexes like you did, but NOT letting me set them with passed variables.

    So:

    function(i,j,z)
    arr[i][j]["hello"] = z;
    end

    wouldn't work (assuming it was already initialized properly with arr[i]={}, arr[i][j]={})

  7. #57
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    I'm getting some inconsistent results, I'm going to test this a little more indepth.

  8. #58
    Clicker Multimedia Fusion 2
    Retriever2's Avatar
    Join Date
    Jun 2006
    Location
    United States
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    By the way, I had a chance to ask Jamie about the LPROs and he doesn't know exactly what happens to them, or if the rSDK method for checking them are correct. So yeah I'm gonna go ahead and say doing any MMF Interface functions on a destroyed object is undefined, and it may or may not do bad things at some point.

    The next build will include an action to clear an object from the export list.

  9. #59
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    An LPRO remains valid until the end of the frame with a "Destroyed" flag set. Perhaps this could be used in XLua somehow to make it break references to destroyed objects automatically?

  10. #60
    No Products Registered

    Join Date
    Oct 2006
    Location
    South Africa
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    If you could do it automatically, that'll be good. Maybe add a void mmf.DestroyCallback (number objectID) function too.

Page 6 of 43 FirstFirst ... 4 5 6 7 8 16 ... LastLast

Similar Threads

  1. XLua
    By Retriever2 in forum Released Extensions
    Replies: 6
    Last Post: 13th August 2017, 07:42 PM
  2. Extention error with exe
    By Jinxtengu in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 15th October 2012, 03:47 AM
  3. SPC extention question
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 20th November 2009, 03:25 PM
  4. Lua+ or xLua?
    By Shawn in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 17th October 2009, 10:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •