Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Am I going bonkers or has Box2d disappeared from the Gideros player? — Gideros Forum

Am I going bonkers or has Box2d disappeared from the Gideros player?

bowerandybowerandy Guru
edited September 2012 in General questions
Okay, I know I'm showing my naivety here, having never used physics before, but when I do a require "box2d" I get a "module box2d not found" error. But only if I try and run in the player on a real device. If I use the desktop player it works okay.

What am I missing here? (either mentally or physically)

best regards

Likes: mehmetuysal

+1 -1 (+1 / -0 )Share on Facebook

Comments

  • atilimatilim Maintainer
    can you try to run this code:
    for k in pairs(package.preload) do
    	print(k)
    end
    You should see something like:
    lsqlite3
    gyroscope
    box2d
    lfs
    geolocation
    accelerometer
    socket.core
  • bowerandybowerandy Guru
    edited September 2012
    Hmm.. with my current build I of the plugin I see:
    gyroscope
    geolocation
    accelerometer
    wax
    However, when I start again I see loads more including box2d. Adding the BhWax files back in seems bring the problem back. Since one of the files is "lobject.h", could this be causing the problem?

    I don't think the distribution of Gideros includes that file (does it?). Hence I had to take the one that came with Wax. Do I need a specific one for Gideros?

    best regards
  • I don't think it's "lobject.h" after all. Something in my plugin file BhWax.mm seems to be clearing out the list of loaded plugins.
  • atilimatilim Maintainer
    I've also looked at wax and BhWax.mm but couldn't catch a clue.
  • Just found it!

    Calling wax_setup() inside g_initializePlugin() seems to wipe the global table and hence knowledge of all previously loaded plugins. I've moved the wax_setup() to loader() with a guard variable to stop it happening more than once. This seems to fix the problem although I'm not quite sure why it's that different. Still, I've pushed the fixed version up to BhWax in GitHub.

    Truth is, I don't totally understand the plugin setup mechanism and when the various functions are called and what they do/expect on the stack. So, if you (@atilim) could just take a quick look over what I've done and comment, I'd be most grateful.

    best regards
  • atilimatilim Maintainer
    Accepted Answer
  • Thanks, but forget that latest version, it didn't help - it just deferred the problem until BhWax was loaded - then all the plugins were lost. I'll revert the change out in GitHub.

    The problem seems to be with the luaL_openLibs() call in wax_setup(). Commenting that out seems to wipe the plugins. For the time being I'll use the (usingExternalLuaState) variable I added to say whether this should be called or not.
Sign In or Register to comment.