Skip to main content
Skip to main content

BaleUnpackEvent

BaleUnpackEvent

Description

Event for bale unpacking

Parent

Event

Functions

emptyNew

Description

Create instance of Event class

Definition

emptyNew()

Return Values

anyselfinstance of class event

Code

function BaleUnpackEvent.emptyNew()
local self = Event.new( BaleUnpackEvent _mt)
return self
end

new

Description

Create new instance of event

Definition

new(table bale)

Arguments

tablebalebale

Return Values

tableinstanceinstance of event

Code

function BaleUnpackEvent.new(bale)
local self = BaleUnpackEvent.emptyNew()
self.bale = bale
return self
end

readStream

Description

Called on client side on join

Definition

readStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function BaleUnpackEvent:readStream(streamId, connection)
if not connection:getIsServer() then
self.bale = NetworkUtil.readNodeObject(streamId)
end

self:run(connection)
end

run

Description

Run action on receiving side

Definition

run(Connection connection)

Arguments

Connectionconnectionconnection

Code

function BaleUnpackEvent:run(connection)
self.bale:unpack()
end

writeStream

Description

Called on server side on join

Definition

writeStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function BaleUnpackEvent:writeStream(streamId, connection)
if connection:getIsServer() then
NetworkUtil.writeNodeObject(streamId, self.bale)
end
end