Marmalade Quick

edited July 2015 in Lua and Corona
I am trying to use Photon Realtime with Marmalade Quick, but I keep getting this error:
QUICKCPP ERROR: [string "main.lua"]:41: attempt to call method 'connectToRegionMaster' (a nil value)

This is the code I am using (mostly from the Corona SDK Hello World example)
-- Your app starts here!
print("Multiplayer Test")

photon = require("photon")
LoadBalancingClient = require("photon.loadbalancing.LoadBalancingClient")
LoadBalancingConstants = require("photon.loadbalancing.constants")
Logger = require("photon.common.Logger")
tableutil = require("photon.common.util.tableutil")    

local appInfo = require("cloud-app-info")

local client = LoadBalancingClient.new(appInfo.ServerAddress, appInfo.AppId, appInfo.AppVersion)

client.mState = "Init"
client.mLastSentEvent = ""
client.mSendCount = 0
client.mReceiveCount = 0
client.mLastReceiveEvent= ""
client.mRunning = true

function client:update()
    self:sendData()
    self:service()
end

function client:sendData()
    if self:isJoinedToRoom() and self.mSendCount < MAX_SENDCOUNT then
        self.mState = "Data Sending"    
        local data = {}
        self.mLastSentEvent = "e" .. self.mSendCount
        data[2] = self.mLastSentEvent
        data[3] = string.rep("x", 160)
        self:raiseEvent(EVENT_CODE, data, { receivers = LoadBalancingConstants.ReceiverGroup.All } ) 
        self.mSendCount = self.mSendCount + 1
        if self.mSendCount >= MAX_SENDCOUNT then
            self.mState = "Data Sent"
        end
    end
end

client:connectToRegionMaster("EU")

while true do
  client:update()
end

Comments

  • Hi,

    Looks like Photon lib is outdated. How this lib is imported in your project? Can you update it?
  • Hi,
    I am just using the ones that ship with the latest version of Marmalade (7.8). How can I update this to the correct files?
  • Photon is bundled with Marmalade Quick, so you can't update it yourself.
    However, you can try old api which does not use nameserver but connects to master directly.
    Set appInfo.ServerAddress to app-eu.exitgamescloud.com:5055 or other region of your choice and connect with
    client:connect()

    We are considering options to update Marmalade Quick Photon now.
Sign In or Register to comment.