This has happened to me twice now, so I'm documenting it so that when it happens again to me, it might show up in Google
. (Also, maybe it will help someone else
)
So you've written your plugin, and it all looks good, but it won't run.
You've required your plugin in Gideros Studio:
You've got your C initialiser:
static void g_initializePlugin(lua_State *L)
{
lua_getglobal(L, "package");
lua_getfield(L, -1, "preload");
lua_pushcfunction(L, loader);
lua_setfield(L, -2, "myplugin");
lua_pop(L, 2); |
And you keep getting this error in Gideros Studio:
main.lua:3: module 'myplugin' not found:
no field package.preload['myplugin']
no file './myplugin.lua'
no file '/usr/local/share/lua/5.1/myplugin.lua'
no file '/usr/local/share/lua/5.1/myplugin/init.lua'
no file '/usr/local/lib/lua/5.1/myplugin.lua'
no file '/usr/local/lib/lua/5.1/myplugin/init.lua'
no file './myplugin.so'
no file '/usr/local/lib/lua/5.1/myplugin.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback: |
Solution:You need to add your plugin file to the Xcode target.
To do this:
1. In Xcode, click on GiderosiPhonePlayer at the top left.
2. Click the GiderosiPhonePlayer under Target
3. Choose Build Phases
4. Open Compile Sources
5. Click the + and add your plugin file to the target.
Comments
My apps: http://www.yummyyellow.com
Working on a detailed tutorial on creating plugins for Android right now.