PEDN> Main Web>ParaWorldAPI>ParaWorldAPIHeaderFile (2008-02-29, LiXizhi) Change language en zh-cn? EditAttach

ParaWorld API HeaderFile?

header file for all server side paraworld application programming interface.

Title header file for all server side paraworld application programming interface.
Author(s) LiXizhi
Date 2008/1/21
File script/kids/3DMapSystemApp/API/ParaworldAPI.lua

Description

Each server side api function is an asynchronous RPC (remote procedure call) wrapper. Take the AuthUser? RPC for instance (one can open "paraworld.auth.lua" for reference), a paraworld RPC wrapper is in the following declaration format:

function paraworld.auth.AuthUser(msg, id, callbackFunc, callbackParams) -- asynchronous call which returns immediately. end

@param msg: msg is always the input xml table of the RPC, which is documented above the function declaration.

NOTES
cookie data are automatically appended for RPCs that require them. Commmon cookie variables are sessionkey, userid, app_key, etc. However, if you include any of these variables explicitly in your message, it will override default corresponding cookie variables.
@param id: id is a string indicating a given caller. Please note that if one tries to call the same function twice with the same id, the function will fail if first call does not return. however, one can specify nil to id, to force calling multiple times even the previous call does not response. Usually, the application name or application key is used as id, when the application is trying to make a call to a server side API. @param callbackFunc: a function pointer of type function (msg, params) end. when the RPC returns, the callbackFunc will be called. The params is optional. see below.
NOTES
in the callbackFunc, one should always check for the error code and handle it gracefully.
@param callbackParams: [optional] this is an optional table or value that will be passed to the second params of the callbackFunc when calling back. @return: it will return true if succeed. or it will return nil or a error code (paraworld.errorcode.RepeatCall) or error message.

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemApp/API/ParaworldAPI.lua");
Topic revision: r1 - 2008-02-29 - 15:26:12 - LiXizhi
 

ParaEngine Developer Network

This site is powered by the TWiki collaboration platformCopyright © 2004-2008 ParaEngine Corporation
Ideas, requests, problems regarding ParaEngine platform Send feedback