Corona NATIVE plugin lua GBCLanguageCabinet

Hello, please help me to understand

I use
  plugins =
    {
      [“plugin.GBCLanguageCabinet”] = {
      publisherId = “com.gamesbycandlelight”,
      },
    },

I have downloaded plugin

https://coronalabs.com/blog/2017/10/19/using-plugins-with-native-android-builds/

It downloaded in folder
“C:\Users\root\AppData\Roaming\Corona Labs\Corona Simulator\NativePlugins\android\plugin.GBCLanguageCabinet_com.gamesbycandlelight”

The project is in
C:\games\android\myprogramm

Inside of downloaded archive
folders there are:
  NativePlugins
    plugin.GBCLanguageCabinet_com.gamesbycandlelight.tgz.
    (inside there is lua file plugin.GBCLanguageCabinet_com.gamesbycandlelight\lua\lua_51\plugin    \GBCLanguageCabinet.lua))
  Plugin
    catalog.json
    plugin
    plugin.bit.zip
    plugin.GBCLanguageCabinet.zip
    plugin.iCloud.zip
    plugin_bit.dll
    plugin_icloud.lua
  Skins
    Empty

I also found GBCLanguageCabinet at https://bitbucket.org/coronalabs/
It has also lua file but also contains manifest.json file.

Where should i put it all?
Tried to Native Plugins/Android - got error
about /Users/jenkins/slaveroot//workspace/Enterprise/OS/ios-11.2/release/release/perform/resources/init.lua:
9056 module ‘plugin.GBCLanguageCabinet’ not found:resource (plugin.GBCLanguageCabinet.lu) does not exist in archive
no field
and some more strings…

(sorry cannot post images here)

Can’t get any ideas. Why iOS? Is the path i put it correct?

As far as i got to know. GDBC is lua plugin adn
Lua plugin is just must be puted in PROJECT/Corona/plugin/GDBCLanguageCabinen.lua
and that’s all

That is correct, in your project folder there should be a Corona folder. Inside of that folder, create a folder name “plugin” and move the GBCLanguageCabinet.lua file to it.

Rob

Anybody nows how to pass variable from java native code to corona sdk?

I found that I should use luaState.poolString("");

But:

  1. I have error when building project

java\plugin\library\LuaLoader.java:
uses or overrides a deprecated API.
Recompile with -Xlint:deprecation for details.

and a lot of errors on Luastate objects

error: cannot find symbol variable luaState

  1. I use android\app\src\main\java\com\mycompany\app\CoronaApplication.java.

from Corona Project Template

Here it is

package com.mycompany.app;

/**
 * Extends the Application class to receive Corona runtime events and to extend the Lua API.
 * <p>
 * Only one instance of this class will be created by the Android OS. It will be created before this application’s
 * activity is displayed and will persist after the activity is destroyed. The name of this class must be set in the
 * AndroidManifest.xml file’s “application” tag or else an instance of this class will not be created on startup.
 */
public class CoronaApplication extends android.app.Application {
    /** Called when your application has started. */
    @Override
    public void onCreate() {
        super.onCreate();
        // Set up a Corona runtime listener used to add custom APIs to Lua.
        com.ansca.corona.CoronaEnvironment.addRuntimeListener(new CoronaApplication.CoronaRuntimeEventHandler());
    }
    
    /** Receives and handles Corona runtime events. */
    private class CoronaRuntimeEventHandler implements com.ansca.corona.CoronaRuntimeListener {
        /**
         * Called after the Corona runtime has been created and just before executing the “main.lua” file.
         * This is the application’s opportunity to register custom APIs into Lua.
         * <p>
         * Warning! This method is not called on the main thread.
         * @param runtime Reference to the CoronaRuntime object that has just been loaded/initialized.
         *                Provides a LuaState object that allows the application to extend the Lua API.
         */
        @Override
        public void onLoaded(com.ansca.corona.CoronaRuntime runtime) {
            //luaState.pushBoolean(“11111”);
            luaState.pushString(“11111”);
            //return 1;
        }
        
        /**
         * Called just after the Corona runtime has executed the “main.lua” file.
         * <p>
         * Warning! This method is not called on the main thread.
         * @param runtime Reference to the CoronaRuntime object that has just been started.
         */
        @Override
        public void onStarted(com.ansca.corona.CoronaRuntime runtime) {
        }
        
        /**
         * Called just after the Corona runtime has been suspended which pauses all rendering, audio, timers,
         * and other Corona related operations. This can happen when another Android activity (ie: window) has
         * been displayed, when the screen has been powered off, or when the screen lock is shown.
         * <p>
         * Warning! This method is not called on the main thread.
         * @param runtime Reference to the CoronaRuntime object that has just been suspended.
         */
        @Override
        public void onSuspended(com.ansca.corona.CoronaRuntime runtime) {
        }
        
        /**
         * Called just after the Corona runtime has been resumed after a suspend.
         * <p>
         * Warning! This method is not called on the main thread.
         * @param runtime Reference to the CoronaRuntime object that has just been resumed.
         */
        @Override
        public void onResumed(com.ansca.corona.CoronaRuntime runtime) {
        }
        
        /**
         * Called just before the Corona runtime terminates.
         * <p>
         * This happens when the Corona activity is being destroyed which happens when the user presses the Back button
         * on the activity, when the native.requestExit() method is called in Lua, or when the activity’s finish()
         * method is called. This does not mean that the application is exiting.
         * <p>
         * Warning! This method is not called on the main thread.
         * @param runtime Reference to the CoronaRuntime object that is being terminated.
         */
        @Override
        public void onExiting(com.ansca.corona.CoronaRuntime runtime) {
        }
    }
}

 

As far as i got to know. GDBC is lua plugin adn
Lua plugin is just must be puted in PROJECT/Corona/plugin/GDBCLanguageCabinen.lua
and that’s all

That is correct, in your project folder there should be a Corona folder. Inside of that folder, create a folder name “plugin” and move the GBCLanguageCabinet.lua file to it.

Rob

Anybody nows how to pass variable from java native code to corona sdk?

I found that I should use luaState.poolString("");

But:

  1. I have error when building project

java\plugin\library\LuaLoader.java:
uses or overrides a deprecated API.
Recompile with -Xlint:deprecation for details.

and a lot of errors on Luastate objects

error: cannot find symbol variable luaState

  1. I use android\app\src\main\java\com\mycompany\app\CoronaApplication.java.

from Corona Project Template

Here it is

package com.mycompany.app;

/**
 * Extends the Application class to receive Corona runtime events and to extend the Lua API.
 * <p>
 * Only one instance of this class will be created by the Android OS. It will be created before this application’s
 * activity is displayed and will persist after the activity is destroyed. The name of this class must be set in the
 * AndroidManifest.xml file’s “application” tag or else an instance of this class will not be created on startup.
 */
public class CoronaApplication extends android.app.Application {
    /** Called when your application has started. */
    @Override
    public void onCreate() {
        super.onCreate();
        // Set up a Corona runtime listener used to add custom APIs to Lua.
        com.ansca.corona.CoronaEnvironment.addRuntimeListener(new CoronaApplication.CoronaRuntimeEventHandler());
    }
    
    /** Receives and handles Corona runtime events. */
    private class CoronaRuntimeEventHandler implements com.ansca.corona.CoronaRuntimeListener {
        /**
         * Called after the Corona runtime has been created and just before executing the “main.lua” file.
         * This is the application’s opportunity to register custom APIs into Lua.
         * <p>
         * Warning! This method is not called on the main thread.
         * @param runtime Reference to the CoronaRuntime object that has just been loaded/initialized.
         *                Provides a LuaState object that allows the application to extend the Lua API.
         */
        @Override
        public void onLoaded(com.ansca.corona.CoronaRuntime runtime) {
            //luaState.pushBoolean(“11111”);
            luaState.pushString(“11111”);
            //return 1;
        }
        
        /**
         * Called just after the Corona runtime has executed the “main.lua” file.
         * <p>
         * Warning! This method is not called on the main thread.
         * @param runtime Reference to the CoronaRuntime object that has just been started.
         */
        @Override
        public void onStarted(com.ansca.corona.CoronaRuntime runtime) {
        }
        
        /**
         * Called just after the Corona runtime has been suspended which pauses all rendering, audio, timers,
         * and other Corona related operations. This can happen when another Android activity (ie: window) has
         * been displayed, when the screen has been powered off, or when the screen lock is shown.
         * <p>
         * Warning! This method is not called on the main thread.
         * @param runtime Reference to the CoronaRuntime object that has just been suspended.
         */
        @Override
        public void onSuspended(com.ansca.corona.CoronaRuntime runtime) {
        }
        
        /**
         * Called just after the Corona runtime has been resumed after a suspend.
         * <p>
         * Warning! This method is not called on the main thread.
         * @param runtime Reference to the CoronaRuntime object that has just been resumed.
         */
        @Override
        public void onResumed(com.ansca.corona.CoronaRuntime runtime) {
        }
        
        /**
         * Called just before the Corona runtime terminates.
         * <p>
         * This happens when the Corona activity is being destroyed which happens when the user presses the Back button
         * on the activity, when the native.requestExit() method is called in Lua, or when the activity’s finish()
         * method is called. This does not mean that the application is exiting.
         * <p>
         * Warning! This method is not called on the main thread.
         * @param runtime Reference to the CoronaRuntime object that is being terminated.
         */
        @Override
        public void onExiting(com.ansca.corona.CoronaRuntime runtime) {
        }
    }
}