Re: MMF interface, faster?
whatever's exposed in the interface is going to be much faster than a docall (or any function call that runs through events)
whether this is noticeable or not depends on what you're doing; usually the differences don't show up unless you're doing thousands of calls per frame
Re: MMF interface, faster?
Thanks for the reply xyzzy!
Re: MMF interface, faster?
also i was bored so i threw this together which shows the kind of differences that show up for many objects
http://file.walagata.com/w/supermetalmario/mmfisp.zip
Re: MMF interface, faster?
Now that's awesome!
Thanks for that! I'm convinced. I need to move all my code into xlua.
I only have one object that I need to control from xlua, but many instances of it much like in your example. I have my own ID system for the objects, so how could I reference the objects by their id in order to do stuff to them?
Thanks a bunch xyzzy, I almost dropped the idea of moving the code to xlua, but that example proves I need to.
Re: MMF interface, faster?
Quote:
Originally Posted by UrbanMonk
I have my own ID system for the objects, so how could I reference the objects by their id in order to do stuff to them?
what is the id system based on? spread value?
Re: MMF interface, faster?
The ID's are loaded from an array, BUT I suppose I could use spread value though, it wouldn't make a difference.
Re: MMF interface, faster?
that ipairs loop is basically equivalent to a spread-value/fastloop engine so you have direct access to the objects already
if you need the ability to, say, get a specific object given a specific id (assuming they're unique), you may want to maintain a reverse lookup table for the object ids
Re: MMF interface, faster?
Hmm ok,
How would I make that reverse lookup table? I would need a way to get the lua id for the object based on the value of one of it's alterable variables.
Re: MMF interface, faster?
rt = {}
objects = mmf.newObjectClass("Active").objectList
for i,v in ipairs(objects) do
local id = v.values[mmf.ALT_A]
rt[id] = v
end
Re: MMF interface, faster?
Oh! Makes sense!
I'll try this when I get a chance!
Thanks alot! You saved me a lot of trouble!