User Tag List

Page 7 of 43 FirstFirst ... 5 6 7 8 9 17 ... LastLast
Results 61 to 70 of 426

Thread: XLua extention beta

  1. #61
    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 don't think I can hook the actual destroy object action, but I can release the association if you try to use MMFI functions on a destroyed object.

  2. #62
    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

    In ValueAdd (which pairs objects to a map of "unlimited" extra alterable values), I have the following code to free the memory I was using for objects which have been destroyed:
    Code:
    // ----------------
    // HandleRunObject
    // ----------------
    // Called (if you want) each loop, this routine makes the object live
    // 
    short WINAPI DLLExport HandleRunObject(LPRDATA rdPtr)
    {
    	variable_map::iterator i = rdPtr->pVariableMap->begin();
    
    	for ( i; i != rdPtr->pVariableMap->end(); )
    	{
    		if (i->first->hoFlags & HOF_DESTROYED)
    		{
    			i = rdPtr->pVariableMap->erase(i);
    		}
    		else
    		{
    			i++;
    		}
    	}
    
    	// Will be called next loop	
    	return 0;
    }
    Hope it helps.

    EDIT: Of course because ValueAdd is only accessed from MMF, the functions can never be called on a destroyed object. For your Lua binding you're going to have to check the destroyed flag yourself in every call as well. You'd also need something like the above because an LPRO isn't valid past the end of the frame if it has been destroyed, and you could get crashes.

    The alternative is to use "Fixed Values", which combine a unique ID (frame number (i.e. time) I think) and the object's index in the object list (which can be reused). You can use this to get an object out of the list and check to see if it is the same one you bound to. I think you'd still need to check the destroyed flag in each call, you just wouldn't need to run a loop like the above every frame.

  3. #63
    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

    A potentially large loop at FPS times per second is something I'd rather avoid. Global state does present a potential for crashing, but a single call to reset exports before jumping to a new frame mitigates that.

    I've updated the XLua object again: http://hocuspocus.taloncrossing.com/rii/xlua-dist.zip

    This includes an action to free individual exports, which ideally you would do immediately prior to destroying the object.

    This also includes ramped up support for loading and embedding external C Modules. The included opengl example demonstrates this (the opengl support has changed since the release earlier this week).

    Existing precompiled Lua C modules aren't compatible with XLua, but I've included xlua.lib inside the zip file now. Rebuilding against that library will create a compatible C module.

  4. #64
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    Hi Retriever2. Where would I put the LIB file?

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  5. #65
    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

    The lib file has no place in the typical MMF directory structure, and you can safely ignore it. It's there for C/C++ developers who want to write their own C Modules for Lua (or rebuild existing C Modules). One of the more useful ones that I've tested, for example, is LuaSocket.

  6. #66
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    Stephen's Avatar
    Join Date
    Aug 2008
    Location
    Montana
    Posts
    4,515
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    I am pretty sure you just extract the files to your MMF2 directory, Marv, but I could be wrong...

    Edit: Yep. Don't mind me.
    Retriever2, did you get my PM?

    stephen1980
    _____________________________________________
    Nivram's Examples -Need extensions? Send me a PM.-


  7. #67
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    Quote Originally Posted by Retriever2
    Well, I don't think I can hook the actual destroy object action, but I can release the association if you try to use MMFI functions on a destroyed object.
    Right -

    The HOF_DESTROYED flag is set when the object is going to be freed at the end of the frame loop. You can check for that in HandleRunObject, and if it's set, remove the object from the interface and don't use the LPRO again.

  8. #68
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    Thanks for the info Retriever2 and Steven1980.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  9. #69
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    Thanks

    Just curious i notice that with the examples there is a folder with dll's in. Are these required to be placed with anything made in MMF and Xlua to run? or just for used for MMF only and not required when a exe is made?


  10. #70
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,741
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: XLua extention beta

    Actually, you'd have to distribute them with your programs, but you can use MMF's binary data functions to store them in your EXE.

Page 7 of 43 FirstFirst ... 5 6 7 8 9 17 ... 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
  •