Search Unity

Plugins help

Discussion in 'Editor & General Support' started by pgbrandao, Jul 29, 2010.

  1. pgbrandao

    pgbrandao

    Joined:
    Jul 28, 2009
    Posts:
    15
    Hi!

    I'm a user of the Unity 3 beta and currently have a show-stopper problem with plugins. What I want is to access Lua scripts from my game in runtime. So I'm using Tao.Lua, which basically exposes Lua's interface. In addition to this, I've compiled Lua using Xcode as a .bundle.

    The problem is that whenever I call anything through Tao.Lua from my C# code, such as:

    Code (csharp):
    1. Lua.luaL_newstate();
    Unity throws up an EntryPointNotFoundException, such as:

    Code (csharp):
    1. EntryPointNotFoundException: luaL_newstate
    I'm out of ideas. I'm sure the method is there, I've added the bundle to the Plugins directory. Can anyone shed some light?

    Cheers!
    Pedro.
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    likely its in the wrong place. you would put lua and tao both into the plugins folder

    also ensure to not attempt to use the webplayer
     
  3. pgbrandao

    pgbrandao

    Joined:
    Jul 28, 2009
    Posts:
    15
    Thanks dreamora. Unfortunately, they're both in the Assets/Plugins directory already. :?

    Also, the errors happen within the editor, I'm not creating an actual build.
     
  4. pgbrandao

    pgbrandao

    Joined:
    Jul 28, 2009
    Posts:
    15
    Hi everyone!

    I fought with this issue for a while until I figured out the solution: XCode was using g++ to build, which doesn't work unless I use extern "C" (from what I read on the docs; I didn't actually test it). Since the code I'm using is pure C, simply using gcc solved the issue.

    So the command line to build it goes something like:

    Code (csharp):
    1. gcc -mmacosx-version-min=10.3.9 -dynamiclib -arch ppc -arch i686 -o Lua51 *.h *.c
    Afterwards, I take the Lua51 resulting executable and place it on the bundle that was built by XCode earlier, which is in turn placed on the plugins directory. And that seemed to do the trick!

    Cheers,
    Pedro.