Example #1
0
lua_State* inittorch(AAssetManager* manager) {
  /* Declare a Lua State, open the Lua State */
  lua_State *L;
  L = lua_open();
  // set the asset manager
  android_fopen_set_asset_manager(manager);
  THApkFile_setAAssetManager((void *) manager);
  openlualibs(L);
  luaopen_landroidprint(L);
  // add an android module loader to package.loaders
  lua_getglobal(L, "package");        
  lua_getfield(L, -1, "loaders");
  int numloaders = lua_objlen(L, -1);
  lua_pushcfunction(L, loader_android);
  lua_rawseti(L, -2, numloaders+1);
  lua_pop(L, 1);
  return L;
}
Example #2
0
JNIEXPORT void JNICALL Java_com_fiftyply_mosaic_MainActivity_nativeSetAssetManager(JNIEnv* env, jobject obj, jobject assetManager) {
  AAssetManager* mgr = AAssetManager_fromJava(env, assetManager);
  android_fopen_set_asset_manager(mgr);
}