Hi, I am trying to use both AppWarp and App42 Cloud API on my game. However, once I use require("AppWarp.WarpClient"), I can no longer use storage service. Here is a very simple example I am working with.
local composer = require("composer")
local scene = composer.newScene()
appWarpClient = require("AppWarp.WarpClient")
require("App42-Lua-API.Operator")
require("App42-Lua-API.Permission")
require("App42-Lua-API.GeoOperator")
require("App42-Lua-API.OrderByType")
require("App42-Lua-API.Operator")
local JSON = require("App42-Lua-API.JSON")
local queryBuilder = require("App42-Lua-API.QueryBuilder")
local App42API = require("App42-Lua-API.App42API")
local ACL = require("App42-Lua-API.ACL")
local jsonapi = require("json")
local loadsave = require("loadsave")
local App42CallBack = {}
local dbName = "Players"
local collectionName = "Yugi"
local json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}"
App42API:initialize(API_KEY_42,SECRET_KEY_42)
local storageService = App42API:buildStorageService()
storageService:insertJSONDocument(dbName, collectionName, json,App42CallBack)
function App42CallBack:onSuccess(object)
print("dbName is "..object:getDbName())
print("collectionName is "..object:getCollectionName())
print("DocId is "..object:getJsonDocList():getDocId())
print("Created At is "..object:getJsonDocList():getCreatedAt())
print("Updated At is "..object:getJsonDocList():getUpdatedAt())
end
function App42CallBack:onException(exception)
print("Message is : "..exception:getMessage())
print("App Error code is : "..exception:getAppErrorCode())
print("Http Error code is "..exception:getHttpErrorCode())
print("Detail is : "..exception:getDetails())
end
appWarpClient.initialize(API_KEY_42,SECRET_KEY_42)
Nothing difficult. Just trying to get to use both in one file. I am getting the following error however.
C:\Users\Brett\Desktop\Apps\Yu-gi-Oh\AppWarp\WarpUtilities.lua:225: attempt to concatenate local 'user' (a nil value)
stack traceback:
[C]: in function 'error'
?: in function 'gotoScene'
C:\Users\Brett\Desktop\Apps\Yu-gi-Oh\menu.lua:25: in function '_onEvent'
?: in function '?'
?: in function <?:449>
?: in function <?:205>
I have tried using separate API and Secret Keys by making them separate apps, and I have also tried using them in separate scenes. Once the appwarp scene runs, the app42 scene returns the same error.
I have traced down where the issue is occuring, if I remove storageService, the scene loads, but I need storageService, obviously.
When each file is not connected in any way whatsoever, they work perfectly. It seems like Appwarp and App42 Cloud isn't able to be used together, although I read that it can be.
What am I doing wrong? Could you sow a working example of them integrated?
Thanks.