180
Gemini's eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009

LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Embed Size (px)

Citation preview

Page 1: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Gemini's eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009

Page 2: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Copyright Notices

Copyright (c) 2009 Gemini Mobile Technologies, Inc. All rights reserved.

Gemini Mobile® and HyperScale® are registered trademarks of Gemini Mobile Technologies, Inc. in the United States and other countries.

Windows® is a registered trademark of Microsoft Corporation in the United States and other countries.

LifeKeeper® is a registered trademark of SteelEye Technology, Inc.

Portions of Gemini products include third-party technology used under license. One or more of the following notices may apply in connection with the license and use of the Gemini products.

Copyright (c) 1994-2000 Carnegie Mellon University. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1 Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.

2 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3 The name "Carnegie Mellon University" must not be used to endorse or promote products derived from this software without prior written permission. For permission or any legal details, please contact:

Office of Technology TransferCarnegie Mellon University5000 Forbes AvenuePittsburgh, PA 15213-3890(412) 268-4387, fax: (412) [email protected]

4 Redistributions of any form whatsoever must retain the following acknowledgment:

“This product includes software developed by Computing Services at Carnegie Mellon University (http://www.cmu.edu/computing/).”

CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Page 3: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Contents

1 eXplo Lua Script System Developer’s Guide

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

About Lua . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

What the eXplo Lua Script System Can Do . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

What the eXplo Lua Script System Cannot Do . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

eXplo Lua Script System Bytecode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

Content Provider Development and Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

The eXplo Lua API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

Perfomance Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

How to Create Lua Script for eXplo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

Create Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

Using the Test Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

eXplo Lua Script Walkthrough . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

Treasure Box Mini-game Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

Treasure Box Code Lua Script Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

2 eXplo Lua Script System API Reference

Package com.explo.features.script.gmtlib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

Class Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

newByteArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

newCharArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

newIntArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

newLongArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

Page 4: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

newShortArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

newFloatArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

newDoubleArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

newStringArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

newObjectArray. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

getByte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

getChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

getInt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

getLong. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

getShort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

getFloat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

getDouble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

getString. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

getObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

setByte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

setChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

setInt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

setLong . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

setShort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

setFloat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

setDouble. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

setString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

setObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

Class Explo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Explo. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

sleep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

exit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

getProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

getSystemProperty. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

Class Explo3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

Explo3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

2 Contents

Page 5: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

setAvatarPosition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

setNpcPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

setAvatarDirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

setNpcDirection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

setAvatarAction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

setNpcAction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

getAvatarPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

getPlayerPosition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

getNpcPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

getAvatarDirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

getPlayerDirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

getNpcDirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

getPlayerByPID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

getPlayerByName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

getNpcByName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

getRadarPlayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

getRadarNpc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

setCameraMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

setCameraDistance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

setCameraHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

setAvatarHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

setChatCameraMode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

Class ExploHttp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

ExploHttp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

getURL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

getProtocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

getHost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

getQuery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

Contents 3

Page 6: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getPort. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

getRequestMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

setRequestMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

getRequestProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

setRequestProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

getResponseCode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

getHeaderField. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

openDataOutputStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

openDataInputStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

Class ExploUI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

ExploUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

createWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

createWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

getWidth. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

getHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

addWindow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

showWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

hideWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

removeWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

removeAllWindows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

getLeftCmdKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

getRightCmdKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

getGameCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

drawBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

drawBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

wordWrap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

Class JER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

JER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

decode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

4 Contents

Page 7: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Class Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Session. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

invite. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

invite. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

reply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

send . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

send . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

getMembers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

Class Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

Window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

getWidth. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

getHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

getX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

setX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

getY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

setY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

isVisible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

setListener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

repaint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

repaint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

repaintAll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

Class GridBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

GridBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

Class GridLayout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

Contents 5

Page 8: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

GridLayout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

setFixedSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

layoutItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

getShrinkWH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

getRows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

getColumns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

getHgap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

getVgap. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

setHgap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

setVgap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

setRows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

setColumns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

getSingleMaxWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

getSingleMaxHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

getRowMaxWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

getRowMaxHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

getSumRowWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

getSumRowHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

getLayout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

setLayout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

getNumOfItems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

Class ScrollDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

ScrollDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

getWidth. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

getHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

getX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

setX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

getY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

setY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

isVisible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

setListener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

6 Contents

Page 9: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

repaint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

repaint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

repaintAll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

addCmd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

removeCmd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

removeAllCmd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

getTitle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

setTitle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

enableScrollbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

setScrollbarColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

setScrollbarBGColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

setScrollbarBorderColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

setLayout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

addItem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

resetScrollHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

setItems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

getCurrentItemIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

setItems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

setHighLightFocus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

getItemsCnt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

forwardFocus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

backFocus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

setFocus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

getItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

removeAllItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

Class IconItemWithBorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

IconItemWithBorder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

setIcon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

getIcon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

setLabel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

getLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

computeSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

Class Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101

Contents 7

Page 10: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103

Item. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103

getX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

getY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

getWidth. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

getHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

getHgap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

getVgap. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

getAnchor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

getFocus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

getEnable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

getVisible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

setX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

setY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

setFocus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

setEnable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

setPressed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

setVisible. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

setAnchor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

setLabelH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

getLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

computeSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

Class StringInfoItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .108

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .108

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .108

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109

StringInfoItem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109

GetLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

setLabel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

getLabelFont. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

setLabelFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

setGap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

getImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

setLabelColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

8 Contents

Page 11: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

computeSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

Class TextFieldItem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113

TextFieldItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113

setInputBoxTitle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

setPreScreen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

setAlignMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

setBorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

setMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

setFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

setContentColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

setInputScreenTitle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

getInput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

showInputScreen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

computeSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

setLabel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

setText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

getText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

Package com.explo.features.script.io . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117

Class DataInputStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120

read. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

read. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

skip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

available . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

mark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

markSupported . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

readToString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

readFully . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

Contents 9

Page 12: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

skipBytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

readBoolean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

readByte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

readUnsignedByte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

readShort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

readUnsignedShort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

readChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

readInt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

readLong . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

readFloat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

readDouble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

readUTF. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

Class DataOutputStream. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .126

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .126

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .126

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127

DataOutputStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127

write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

flush . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

writeBoolean. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

writeByte. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

writeShort. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

writeChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

writeInt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

writeLong . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

writeFloat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

writeDouble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

writeChars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

writeUTF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

Package com.explo.features.script.lib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .131

Class Font. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132

10 Contents

Page 13: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .133

Font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .133

getDefaultFont. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

getFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

getFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

getStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

getSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

getFace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

isPlain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

isBold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

isItalic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

isUnderlined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

getHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

getBaselinePosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

charWidth. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

charsWidth. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

stringWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

substringWidth. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

Class Graphics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .139

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .139

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .139

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142

Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142

translate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

getTranslateX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

getTranslateY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

getColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

getRedComponent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

getGreenComponent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

getBlueComponent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

getGrayScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

setColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

setColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

setGrayScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

getFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

setStrokeStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

Contents 11

Page 14: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getStrokeStyle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

setFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

getClipX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

getClipY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

getClipWidth. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

getClipHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

clipRect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

setClip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

drawLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

fillRect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

drawRect. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

drawRoundRect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

fillRoundRect. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

fillArc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150

drawArc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150

drawString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

drawSubstring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

drawChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

drawChars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

drawImage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

drawRegion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

copyArea. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

fillTriangle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

drawRGB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

getDisplayColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

Class Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .157

Image. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .157

createImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

createImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

createImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

createImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

createImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

getGraphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

getWidth. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

12 Contents

Page 15: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

isMutable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

createRGBImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

getRGB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

Class Sprite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .162

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .162

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .162

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164

Sprite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164

create . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164

create . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164

create . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

defineReferencePixel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

setRefPixelPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

getRefPixelX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

getRefPixelY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

setFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

getFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

getRawFrameCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

getFrameSequenceLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

nextFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

prevFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

paint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

setFrameSequence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

setImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

defineCollisionRectangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

setTransform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

collidesWith. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

collidesWith. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

setPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

getX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

getY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

getWidth. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

getHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

setVisible. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

isVisible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

Contents 13

Page 16: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Class Timer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173

Constructor Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173

Method Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173

Constructor Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174

Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

Method Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174

schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

cancel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

Package com.explo.features.script.vm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .176

Class Closure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177

Class LuaTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .178

14 Contents

Page 17: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

1 eXplo Lua Script System Developer’s Guide

This chapter covers these topics:

■ Overview‚ on page 16

■ How to Create Lua Script for eXplo‚ on page 22

■ eXplo Lua Script Walkthrough‚ on page 25

Page 18: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

OverviewThis overview describes the eXplo Lua Script System—what it is capable of, and what it cannot do.

The eXplo Lua Script System is a scripting language which runs on the eXplo client. A content provider can write and deploy the eXplo Lua Script System to add interactive action onto eXplo virtual spaces without upgrading the whole eXplo application.

The purpose of eXplo script is to provide a development environment to content providers that they can use to define their own unique interaction on eXplo virtual spaces. By adding the eXplo Lua script onto the virtual spaces, content providers can give an interactive, everyday changing entertainment to users.

About Lua

The eXplo Lua Script System is based on Lua (pronounced LOO-uh), a scripting language with extensible semantics that has enjoyed great popularity and been adopted by the video games, computer entertainment industry. For instance, PlayStation Home adopts Lua for 2D games, World of Warcraft allows users to customize its user interface, and Ratchet & Clank Future: Tools of Destruction is scripted using Lua.

Lua programs are compiled into bytecodes which are then run on a Lua virtual machine. The bytecode interpreter is already implemented on many mobile platforms and embedded systems including J2ME, BREW, WinCE and Lego Mindstorms.

The eXplo Lua Script Developer Guide and API assumes that you have already learned some Lua language. If you don't have any experience, please refer to www.lua.org.

What the eXplo Lua Script System Can Do

The eXplo Lua Script System can be used to:

■ Interact with virtual space objects, for instance, pet, other players or non-player characters (NPCs)

■ Create single player mini-games

■ Create player-to-player chat or mini-games

■ Replace an application's default UI

■ Control eXplo’s task system

16 Overview

Page 19: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

The eXplo Lua Script System includes a Graphics library for both Sprite and Window management. This library allows a content provider to create new 2D games and to dynamically run these games on the eXplo application.

The eXplo Lua Script System also has an eXplo3D class for manipulating virtual worlds that includes NPC and camera control as well as getting information about other players that the player can see in real time.

The eXplo Lua Script System does not have threads but it supports Lua's co-routine mechanism.

The eXplo client is able to be dynamically downloaded and installed. A user can share a mini-game and play it together with friends. Even though one of the users does not have the game, the eXplo client can automatically download, install and run the necessary script.

Use cases for a Pet System could include the following:

■ Update pet and user's parameter

■ Change pet's model and texture

■ Retrieve system message

■ Play text based quiz

■ Get prizes

■ Show ranking

■ Consume items

Three mini-game examples include:

■ Slot machine

■ Treasure hunt

■ Treasure box

The mini-game, Treasure Box, is shown as a code example on page 25.

What the eXplo Lua Script System Cannot Do

Just as important as knowing what the eXplo Lua Script System can do, is understanding the system’s limits.

The script system is not suitable for latency sensitive games like racing. It cannot add or delete 3D object inside virtual space. The model and animation must be pre-set, though by using another tool such as Slot Manager (see the SPSS

Chapter 1 eXplo Lua Script System Developer’s Guide 17

Page 20: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

t

documentation) to update the 3D object, you can dynamically change 3D objects in virtual space.

eXplo Lua Script System Bytecode

The eXplo Lua script is compiled into bytecodes. The bytecode is compressed with resource file like images, etc. The resultant file can be called from an embedded mini-browser inside the eXplo application.

When the script bytecode is triggered by the browser, the eXplo client library downloads the script from the eXplo Server System. The client library passes the scripto the script engine (VM) to run it.

Content Provider Development and Deployment

The following steps are used to develop and deploy the eXplo Lua script.

1 Write the eXplo Lua script.

2 Compile the script into bytecodes.

3 Define the trigger to call the script.

4 Package the bytecode with the necessary art resources

5 Deploy the output files onto the eXplo Virtual Space PuBlisher (VSPB) by manually uploading the packaged file using ftp or scp. Contact Gemini technical support for the directory and SPSS support.

The eXplo Lua API

There are eight basic types in Lua:

■ nil

■ content

■ number

■ string

■ function

■ userdata

■ thread

■ table

The eXplo Lua Script System uses four control structures:

18 Overview

Page 21: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

d

■ if

■ while

■ repeat

■ for

Lua supports function definition and calls.

Explo Lua scripts provides their own set of APIs to implement user interaction in the virtual spaces including:

2D Graphics API provides low level 2D graphics API. This graphics API provides basic functionalitiy of J2ME Graphics class (javax.microedition.lcdui.Graphics). Using this API, the content provider can specify the rendering of images, strings and basic shapes.

Explo Lua scripts provide Window and WindowManager APIs to control a Window baseUI framework.

A key event API is only available in Window. The key event API provides a method to deliver key events to the script. If a window is shown which registers aKEY_PRESS or KEY_RELEASE event listener, ScriptEngine checks and delivers the event to the script with an instanceof KeyEvent class. The callback function in the script uses the KeyEvent API to get the exact integer key value.

To use the key event, the content provider writes the defined Window and calls setListener to register the key event. If the KEY_PRESS and KEY_RELEASE event listener are not specified by the content provider, the key event is ignored.

Available keys are 1-9, *, #, left, right, up, down and enter (fire). The content provider cannot specify soft keys because the eXplo Lua script system reserves these keys.

■ getKeyCode()—called when a key is pressed

■ getGameCode()—called when a key is released

The Network API provides API to connect eXplo server systems. Using this API, the content provider can update the user's status such as the virtual money account, pet status stored on the server, check other player's status, get system information and so on.

The camera in eXplo application tracks player avatar's movement. The camera position is defined by the player avatar's height and the camera's height and

Chapter 1 eXplo Lua Script System Developer’s Guide 19

Page 22: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

distance. Camera management API provides functionality to get and set camera's position.

Perfomance Considerations

This eXplo Lua script system is not suitable for response time sensitive applications such as action or racing games.

Use the content cache mechanism to cache script. Two working flow diagrams follow. The first shows the working content cache mechanism, the second sequence is not cached.

20 Overview

Page 23: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Chapter 1 eXplo Lua Script System Developer’s Guide 21

Page 24: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

How to Create Lua Script for eXploThe LUA API for eXplo is the basis to make mini-games available on the cell phone without integrating them into the eXplo code. The Lua APIs are stored in the code and the game is downloaded and reloaded whenever played.

Create Script

Let's create the script which can be run in the eXplo Mobile Application.

1 Write the script in a text file then rename it for example, test.lua. Make sure the extension of the file is .lua.

2 Compile the executable command using luac.exe. Make sure the extension of this file is .lbc.

Figure 1.1 Using luac.exe to compile

3 Package all the artwork and .lbc files in a binary file named xxx.lzp. ResourcePackTool.exe is provided to package the resources. Double click ResourcePackTool.exe.

Alternatively, use the following CLI command to package Lua codes and resources (images). The usage is:

java -jar ScriptPack.jar -i INPUTDIR -o OUTPUTPACKAGE(.lzp)

22 How to Create Lua Script for eXplo

Page 25: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Figure 1.2 Packaging the Resources

Make sure the extension of the file is .lzp. There must be a .lbc file with the same name within the binary packaged file. This .lbc file will be the entrance.

For example, there are three Lua files named a.lua, b.lua and main.lua, after compiling and packaging, the file named main.lzp, it means that main.lua will be called first.

Only files will be packaged. The folder will be ignored.

Using the Test Script

1 Download the debug version of the JAD Java Application Descriptor and JAR (Java ARchive) files application from GMT server.

2 Upload the script. You must have a FTP client and an user and password from GMT.

Once you have these items, upload the script to the GMT server at the same URL that you received the download URL for the script.

To reach Gemini technical support, use the customer-specific email address that Gemini provided you, or go to this web page:

http://www.geminimobile.com/support/

Chapter 1 eXplo Lua Script System Developer’s Guide 23

Page 26: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

3 Modify the JAD by updating the attribute GCXduo-Script-URL in the JAD file with the download URL of the script. GCXduo-Script-URL is the fixed string, it can not be changed.

4 Run the script by logging in and press the '0' and '9' at the same time to call the Lua script feature. The download will take a minute. Please wait for the feature to show. If the emulator is used to test, make sure the script which is uploaded by you is downloaded successfully.

24 How to Create Lua Script for eXplo

Page 27: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

eXplo Lua Script WalkthroughBelow is Treasure Box, a mini-game code example. Other exmples of eXplo Lua scripts can be obtained from Gemini technical support for your reference.

Treasure Box Mini-game Example

This is a very simple game which user selects one of three boxes and gets a result.

The first step is to prepare the image files. The Treasure Box mini-game uses the images in the table below:

img1.png BOMB_BOX

img2.png BOX

img3.png GOLD_BOX

Chapter 1 eXplo Lua Script System Developer’s Guide 25

Page 28: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

The next step is to write the Lua script. A sample is shown Treasure Box Code Lua Script Example‚ on page 26.

Next, compile, package and upload. This can be done in one batch command:

java -jar ScriptPack.jar -i INPUTDIR -o OUTPUTPACKAGE(.lzp)

The final step is to test run the script on your cell phone.

Treasure Box Code Lua Script Example

The following Lua code sample is for a game called Treasure Box.

----------------------------------------------

-- General steps of Treasure Box

-- Show game Window

-- User selects one of 3 treasure boxes

-- Show result and close

----------------------------------------------

--print("load lib")

-- import lib

require "ExploUI"

require "Font"

require "JER"

require "ExploHttp"

require "Explo"

require "Image"

-- variable --

fontH=Font.getDefaultFont().getHeight()

img4.png TASK_BOX (not used)

img5.png CUSRSOR

26 eXplo Lua Script Walkthrough

Page 29: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

--print("create game window")

SW = 176

SH = 83

win = ExploUI.createWindow(SW, SH)

BOMB_BOX = 1

BOX = 2

GOLD_BOX = 3

TASK_BOX = 4

CURSOR = 5

offsetX = 0

offsetY = 0

index = 1

box_w = 0

box_h = 0

cursor_h = 0

cursor_w = 0

box_x = 0

box_y = 0

gap = 5

border_up = 5

border_left = 7

box_index = BOX

box_map = {1,1,1}

GS_WAIT = 0

GS_RUNNING = 1

GS_OVER = 2

gamestate = GS_WAIT

info = ""

gold_num = 0

-- command key

Chapter 1 eXplo Lua Script System Developer’s Guide 27

Page 30: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

FIRE_KEY = 8

UP_KEY = 1

LEFT_KEY = 2

RIGHT_KEY = 5

DOWN_KEY = 6

-- message window height and width

msgWinWidth = 0

msgWinHeight = 0

msgG = nil

msg_data_update = "Game data updating"

msg_data_update_unsucc = "Game data can't be updated, unknown error"

msg_data_update_expired = "Game session id has already expired"

msg_init_unsucc = "Game initialized unsuccessfully, confirm to close"

msg_confirm = "Do you want to select this one?"

msg_congratulation = "Congratulations "

msg_coin = " coins got"

msg_gameover = "Game over"

msg_start = "Start"

msg_close = "Close"

msg_yes = "Yes"

msg_no = "No"

-- command

yesCmd = {msg_yes, 0}

noCmd = {msg_no, 1}

closeCmd = {msg_close, 1}

-- method --

-- -- show message -- --

msgTable = nil

function showMessage(msg,leftCommand,rightCommand)

-- string wrap

msgTable = ExploUI.wordWrap(msg, Font.getDefaultFont(), ExploUI.getWidth() * 3 / 4 - 16)

28 eXplo Lua Script Walkthrough

Page 31: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

mheight = #msgTable * fontH + 16

local wWin = ExploUI.createWindow(ExploUI.getWidth() * 1 / 8, (ExploUI.getHeight() + 83) / 2, ExploUI.getWidth() * 3 / 4, mheight)

msgWinWidth = wWin.getWidth()

msgWinHeight = wWin.getHeight()

--print("msgWinWidth", msgWinWidth)

--print("msgWinHeight", msgWinHeight)

if (leftCommand ~= nil) then

--print("add left command")

wWin.addCmd(leftCommand)

end

if(rightCommand ~= nil) then

--print("add right command")

wWin.addCmd(rightCommand)

end

-- -- public message window method -- --

function wWin:paint(g)

--print("msgWinHeight = ", msgWinHeight)

ExploUI.drawBox(g, msgWinWidth ,msgWinHeight)

g.setFont(Font.getDefaultFont())

g.setColor(0x000000)

for n=1,#msgTable do

--print("fontH * (n - 1) = ", fontH * (n - 1))

g.drawString(msgTable[n], 8, 8 + fontH * (n - 1), 0)

end

end

function wWin:commandAction(cmd)

--print("Command clicked:",cmd)

if yesCmd == cmd then

--print("yesCmd")

Chapter 1 eXplo Lua Script System Developer’s Guide 29

Page 32: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

showMessage(msg_data_update)

box_index = box_map[index]

gamestate = GS_OVER

if box_index == GOLD_BOX then

--showMessage(msg_data_update)

showMessage("" .. msg_congratulation.. amount ..msg_coin, nil, closeCmd)

end

if box_index == BOMB_BOX then

-- show bomb message

showMessage(msg_gameover, nil, closeCmd)

end

elseif noCmd == cmd then

--print("noCmd")

ExploUI.removeAllWindows()

showGameWindow()

elseif closeCmd == cmd then

--print("closeCmd")

ExploUI.removeAllWindows()

Explo.exit()

end

end

wWin.setListener("PAINT",wWin.paint)

wWin.setListener("COMMAND_CLICK",wWin.commandAction)

ExploUI.addWindow(wWin)

ExploUI.showWindow(wWin)

end

function showGameWindow()

ExploUI.addWindow(win)

ExploUI.showWindow(win)

end

30 eXplo Lua Script Walkthrough

Page 33: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

-- -- init -- --

IMG_NUM = 5

amount = 0

images = {}

function initGame()

-- load images

for i = 1, IMG_NUM do

images[i] = Image.createImage("img"..i ..".png")

end

-- init width and height

box_w = images[BOX].getWidth()

box_h = images[BOX].getHeight()

cursor_w = images[CURSOR].getWidth()

cursor_h = images[CURSOR].getHeight()

box_x = offsetX + (SW - ((box_w * 3))) / 2 - gap

box_y = offsetY + (SH - (box_h + cursor_h + gap)) / 2 + cursor_h + gap

-- init coin and box

amount = math.random(50,100)

--print("amount", amount)

local index = math.random(1,3)

--print("index", index)

box_map[index] = GOLD_BOX

--print("boxIndex", box_map[1], box_map[2], box_map[3])

gamestate = GS_RUNNING

end

-- -- game window method -- --

local flag = true

function win:paint(g)

--drawPanel

--print("drawPanel start")

g.setColor(0x535A62)

Chapter 1 eXplo Lua Script System Developer’s Guide 31

Page 34: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

g.drawRect(offsetX, offsetY, SW - 1, SH - 1)

g.setColor(0x737E90)

g.fillRect(offsetX + 1, offsetY, SW - 2, SH)

g.setColor(0x54668A)

g.fillRect(offsetX + 7, offsetY + 5, SW - 15, SH - 10)

g.setColor(0x535965)

g.drawRect(offsetX + 7, offsetY + 5, SW - 15, SH - 10)

g.drawRect(offsetX + 8, offsetY + 6, SW - 17, SH - 12)

--drawBox

--print("drawBox start")

local py = box_y

local px = box_x

for i = 1, 3 do

if index == i then

if(flag) then

flag = false

g.drawImage(images[CURSOR], px + (box_w - cursor_w) / 2, py - (gap + cursor_h), 0)

else

flag = true

g.drawImage(images[CURSOR], px + (box_w - cursor_w) / 2, py - (gap + cursor_h) + 2, 0)

end

g.drawImage(images[box_index], px + 2, py, 0)

else

g.drawImage(images[BOX], px + 2, py, 0)

end

px = px + box_w + gap

end

end

function win:keyReleased(key)

local action = ExploUI.getGameCode(key)

--print("action",action)

32 eXplo Lua Script Walkthrough

Page 35: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

if (action == RIGHT_KEY and gamestate == GS_RUNNING) then

--print("RIGHT_KEY")

if index < 3 then

index = index + 1

else

index = 1

end

end

if (action == LEFT_KEY and gamestate == GS_RUNNING) then

--print("LEFT_KEY")

if index > 1 then

index = index - 1

else

index = 3

end

end

if action == FIRE_KEY then

--print("FIRE_KEY")

if gamestate == GS_RUNNING then

showMessage(msg_confirm, yesCmd, noCmd)

elseif gamestate == GS_OVER then

end

end

end

function win:commandAction(cmd)

--print("Command clicked:",cmd)

if closeCmd == cmd then

--print("closeCmd")

Explo.exit()

end

end

-- main logic

Chapter 1 eXplo Lua Script System Developer’s Guide 33

Page 36: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

--print("main start")

initGame()

win.addCmd(closeCmd)

win.setListener("PAINT",win.paint)

win.setListener("KEY_RELEASE",win.keyReleased)

win.setListener("COMMAND_CLICK",win.commandAction)

showGameWindow()

--print("game finished")

34 eXplo Lua Script Walkthrough

Page 37: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

2 eXplo Lua Script System API Reference

This chaper is the API reference for Gemini’s eXplo script Lua extension. This chapter contains these three packages:

■ Package com.explo.features.script.gmtlib‚ on page 36—The gmtlib package provides a series of API(s) that enable the development of rich gaming or feature content for eXplo applications.

■ Package com.explo.features.script.io‚ on page 117— Provides classes for input and output using data streams.

■ Package com.explo.features.script.lib‚ on page 131 —Provides fundamental classes.

■ Package com.explo.features.script.vm‚ on page 176—Provides classes for fundamental to the LUA standard programming.

Page 38: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Package com.explo.features.script.gmtlibThe classes for com.explo.features.script.gmtlib include:

■ Class Array‚ on page 37

■ Class Explo‚ on page 45

■ Class Explo3D‚ on page 48

■ Class ExploHttp‚ on page 58

■ Class ExploUI‚ on page 65

■ Class JER‚ on page 71

■ Class Session‚ on page 73

■ Class Window‚ on page 77

The classes for com.explo.features.script.gmtlib.ui include:

■ Class GridBase‚ on page 81

■ Class GridLayout‚ on page 82

■ Class ScrollDialog‚ on page 88

The classes for com.explo.features.script.gmtlib.ui.items include:

■ Class IconItemWithBorder‚ on page 98

■ Class Item‚ on page 101

■ Class StringInfoItem‚ on page 108

■ Class TextFieldItem‚ on page 112

36 Package com.explo.features.script.gmtlib

Page 39: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib

Class Arrayjava.lang.Object

com.explo.features.script.gmtlib.Array

public class Array

extends java.lang.Object

The Array Object is a optimized Array holder of LuaTable. it's used to cache a Java native based array like int[ ], byte[ ] etc. The purpose to providing this API is for some frequency operations like Image.drawRGB(int[ ],...). so that the program may achieve fast performance.

Constructor SummaryArray ()

Method Summary

bytegetByte (int index) Gets an expected byte from array.

chargetChar(int index) Gets an expected char from array.

doublegetDouble(int index) Gets an expected double from array.

floatgetFloat(int index) Gets an expected float from array.

intgetInt(int index) Gets an expected integer from array.

longgetLong(int index) Gets an expected long from array.

java.lang.ObjectgetObject(int index) Gets an expected Object from array.

shortgetShort(int index) Gets an expected short from array.

java.lang.StringgetString(int index) Gets an expected String from array.

intlength() Get the length of the array.

static ArraynewByteArray(int size) Create an empty byte array.

static ArraynewCharArray(int size) Create an empty chars array.

Chapter 2 eXplo Lua Script System API Reference 37

Page 40: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

static ArraynewDoubleArray(int size) Create an empty double array.

static ArraynewFloatArray(int size) Create an empty float array.

static ArraynewIntArray(int size) Create an empty integer array.

static ArraynewLongArray(int size) Create an empty long array.

static ArraynewObjectArray(int size) Create an empty Object array.

static ArraynewShortArray(int size) Create an empty short array.

static ArraynewStringArray(int size) Create an empty string array.

voidsetByte(int index, byte b) Update an existed byte to the new one.

voidsetChar(int index, char c) Update an existed char to the new one.

voidsetDouble(int index, double d) Update an existed double to the new one.

voidsetFloat(int index, float f) Update an existed float to the new one.

voidsetInt(int index, int i) Update an existed int to the new one.

voidsetLong(int index, long l) Update an existed long to the new one.

voidsetObject(int index, java.lang.Object o) Update an existed object to the new one.

voidsetShort(int index, short s) Update an existed short to the new one.

voidsetString(int index, java.lang.String s) Update an existed string to the new one.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Summary

38 Class Array

Page 41: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Array

public Array()

newByteArray

public static Array newByteArray(int size)

Create an empty byte array.

Returns: A LuaTable will returned, which will represent the array data create by

native.

newCharArray

public static Array newCharArray(int size)

Create an empty chars array.

Returns:A LuaTable will returned, which will represent the array data create by

native.

newIntArray

public static Array newIntArray(int size)

Create an empty integer array.

Returns:A LuaTable will returned, which will represent the array data create by

native.

newLongArray

public static Array newLongArray(int size)

Create an empty long array.

Constructor Detail

Method Detail

Chapter 2 eXplo Lua Script System API Reference 39

Page 42: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Returns: A LuaTable will returned, which will represent the array data create by

native.

newShortArray

public static Array newShortArray(int size)

Create an empty short array.

Returns:A LuaTable will returned, which will represent the array data create by

native.

newFloatArray

public static Array newFloatArray(int size)

Create an empty float array.

Returns:A LuaTable will returned, which will represent the array data create by

native.

newDoubleArray

public static Array newDoubleArray(int size)

Create an empty double array.

Returns:A LuaTable will returned, which will represent the array data create by

native.

newStringArray

public static Array newStringArray(int size)

Create an empty string array.

Returns: A LuaTable will returned, which will represent the array data create by

native.

40 Class Array

Page 43: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

newObjectArray

public static Array newObjectArray(int size)

Create an empty Object array.

Returns: A LuaTable will returned, which will represent the array data create by

native.

getByte

public byte getByte(int index)

Gets an expected byte from array. a nil will returned if giving index is illegal.

Returns: The corresponding byte value.

getChar

public char getChar(int index)

Gets an expected char from array. a nil will returned if giving index is illegal.

Returns: The corresponding char value.

getInt

public int getInt(int index)

Gets an expected integer from array. a nil will returned if giving index is illegal.

Returns:The corresponding integer value.

getLong

public long getLong(int index)

Gets an expected long from array. a nil will returned if giving index is illegal.

Returns:The corresponding long integer value.

Chapter 2 eXplo Lua Script System API Reference 41

Page 44: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getShort

public short getShort(int index)

Gets an expected short from array. a nil will returned if giving index is illegal.

Returns:The corresponding short integer value.

getFloat

public float getFloat(int index)

Gets an expected float from array. a nil will returned if giving index is illegal.

Returns:The corresponding float point number value.

getDouble

public double getDouble(int index)

Gets an expected double from array. a nil will returned if giving index is illegal.

Returns:The corresponding double value.

getString

public java.lang.String getString(int index)

Gets an expected String from array. a nil will returned if giving index is illegal.

Returns: The corresponding String value.

getObject

public java.lang.Object getObject(int index)

Gets an expected Object from array. a nil will returned if giving index is illegal.

Returns:A LuaTable will returned, which will represent the corresponding Object

value.

42 Class Array

Page 45: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

setByte

public void setByte(int index, byte b)

Update an existed byte to the new one.

setChar

public void setChar(int index, char c)

Update an existed char to the new one.

setInt

public void setInt(int index, int i)

Update an existed int to the new one.

setLong

public void setLong(int index, long l)

Update an existed long to the new one.

setShort

public void setShort(int index, short s)

Update an existed short to the new one.

setFloat

public void setFloat(int index, float f )

Update an existed float to the new one.

setDouble

public void setDouble(int index, double d)

Update an existed double to the new one.

Chapter 2 eXplo Lua Script System API Reference 43

Page 46: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

setString

public void setString(int index, java.lang.String s)

Update an existed string to the new one.

setObject

public void setObject(int index, java.lang.Object o)

Update an existed object to the new one.

length

public int length()

Get the length of the array.

Returns:The length of the array.

44 Class Array

Page 47: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib

Class Explojava.lang.Object

com.explo.features.script.gmtlib.Explo

public class Explo

extends java.lang.Object

The Explo class provides a bridge to access some helper APIs in a Lua script.

Explo

public Explo()

Constructor SummaryExplo()

Method Summary

static voidexit() Quit the current script Feature.

staticjava.lang.String

getProperty(java.lang.String key) Gets the properties from the JAD.

staticjava.lang.String

getSystemProperty(java.lang.String key) Gets the properties that used by the Explo internal system.

static voidsleep(long millsec) Sleep current Java thread for a moment, the time is depends on the given parameter.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Chapter 2 eXplo Lua Script System API Reference 45

Page 48: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

sleep

public static void sleep(long millsec)

Sleep current Java thread for a moment, the time is depends on the given parameter.

Parameters:

millsec -

exit

public static void exit()

Quit the current script Feature.

getProperty

public static java.lang.String getProperty(java.lang.String key)

Gets the properties from the JAD

Parameters:

key -

Returns:The string value of the property.

getSystemProperty

public static java.lang.String getSystemProperty(java.lang.String key)

Gets the properties that used by the Explo internal system.

Parameters:

key -

Method Detail

46 Class Explo

Page 49: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Returns:The string value of the property.

Chapter 2 eXplo Lua Script System API Reference 47

Page 50: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib

Class Explo3Djava.lang.Object

com.explo.features.script.gmtlib.Explo3D

public class Explo3D

extends java.lang.Object

The Explo3D class provides a set of tools to controlling the 3D Objects in eXplo 3D world.

Constructor SummaryExplo3D ()

Method Summary

static doublegetAvatarDirection() Gets the direction of the Avatar.

static double[]getAvatarPosition() Gets the current position of the Avatar.

staticcom.explo.features.script.vm.LuaTable

getNpcByName(java.lang.String name) Gets the NPC table.

static doublegetNpcDirection(java.lang.String npcName) Gets the direction of the NPC.

static double[]getNpcPosition(java.lang.String npcName) Gets the current position of the NPC

staticcom.explo.features.script.vm.LuaTable

getPlayerByName(java.lang.String name) Gets the Player table of the Player.

staticcom.explo.features.script.vm.LuaTable

getPlayerByPID(java.lang.String pid) Gets the Player table of the Player.

static doublegetPlayerDirection(java.lang.String playerID) Gets the direction of the Player.

static double[]getPlayerPosition(java.lang.String playerID) Gets the current position of the Player.

48 Class Explo3D

Page 51: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

staticcom.explo.features.script.vm.LuaTable

getRadarNpc() Gets all NPC in radar area, the result may contain lots of NPC, each single result can be reached by using numeric from 1 to #table.

staticcom.explo.features.script.vm.LuaTable

getRadarPlayer() Gets all Players in radar area, the result may contain lots of Players, each single result can be reached by using numeric from 1 to #table.

static booleansetAvatarAction(int actionIndex) Sets the action of the avatar.

static booleansetAvatarDirection(double dire) Sets the direction of avatar's facing.

static voidsetAvatarHeight(int height) Sets the height of avatar.

static booleansetAvatarPosition(double x, double y, double z) Sets the avatar's position.

static voidsetCameraDistance(double distance) Sets the distance between the avatar and camera.

static voidsetCameraHeight(double height) Sets the camera height.

static void

setCameraMode(int mode) Sets the 3D camera to a allowed mode: DEFAULT_VIEW = 0; BACK_VIEW = 1; FIRSTPERSON_VIEW = 2;

static void

setChatCameraMode(double x, double y, double z) Sets the camera to a extension mode of CHAT_VIEW = 3; this mode is require a face to face chat target position.

static booleansetNpcAction(java.lang.String npcName, int actionIndex) Sets the action of the NPC.

static booleansetNpcDirection(java.lang.String npcName, double dire) Sets the direction of NPC's facing.

static booleansetNpcPosition(java.lang.String npcName, double x, double y, double z) Sets the NPC's position.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Summary

Chapter 2 eXplo Lua Script System API Reference 49

Page 52: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Explo3D

public Explo3D()

setAvatarPosition

public static boolean setAvatarPosition(double x, double y, double z)

Sets the avatar's position.

Parameters:

x - x coordinate

y - y coordinate

z - z coordinate

Returns:

True for success, otherwise false.

setNpcPosition

public static boolean setNpcPosition(java.lang.String npcName, double x, double y, double z)

Sets the NPC's position.

Parameters:

npcName - Name of the NPC

x - x coordinate

y - y coordinate

z - z coordinate

Constructor Detail

Method Detail

50 Class Explo3D

Page 53: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Returns:

True for success, otherwise false.

setAvatarDirection

public static boolean setAvatarDirection(double dire)

Sets the direction of avatar's facing.

Parameters:

dire - The direction in 0~360 degree.

Returns:

True for success, otherwise false.

setNpcDirection

public static boolean setNpcDirection(java.lang.String npcName, double dire)

Sets the direction of NPC's facing.

Parameters:

npcName - Name of NPC

dire - The direction in 0~360 degree.

Returns:

True for success, otherwise false.

setAvatarAction

public static boolean setAvatarAction(int actionIndex)

Sets the action of the avatar. Each project may have the different action list. For example: The following action index are allowed for ThirdLife: ACTION_IDLE = 0; ACTION_WALK = 1; ACTION_TALK = 2; ACTION_KISS = 3; The following action index are allowed for MyCampus: ACTION_IDLE = 0; ACTION_WALK = 1; ACTION_DANCE = 2; ACTION_KISS = 3; ACTION_BECKON = 4; ACTION_BOW = 5; ACTION_CLAP = 6; ACTION_DESPISE = 7; ACTION_EXCITE = 8; ACTION_JUMP = 9; ACTION_ROTATE = 10;

Chapter 2 eXplo Lua Script System API Reference 51

Page 54: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Parameters:

actionIndex - index of the allowed action.

Returns:

True for success, otherwise false.

setNpcAction

public static boolean setNpcAction(java.lang.String npcName, int actionIndex)

Sets the action of the NPC.

Parameters:

npcName - Name of the NPC.

actionIndex - TBD

Returns:

True for success, otherwise false.

getAvatarPosition

public static double[] getAvatarPosition()

Gets the current position of the Avatar.

Returns:

With a Lua table, x,y,z are returned. It can be reached by using [1][2][3] as a suffix of the variable.

getPlayerPosition

public static double[] getPlayerPosition(java.lang.String playerID)

Gets the current position of the Player.

Parameters:

playerID - PlayerID in String

52 Class Explo3D

Page 55: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Returns:

With a lua-table x,y,z are returned , it can be reached by using [1][2][3] as a suffix of the variable.

getNpcPosition

public static double[] getNpcPosition(java.lang.String npcName)

Gets the current position of the NPC.

Parameters:

npcName - Name of the NPC.

Returns:

With a lua-table x,y,z are returned , it can be reached by using [1][2][3] as a suffix of the variable.

getAvatarDirection

public static double getAvatarDirection()

Gets the direction of the Avatar.

Returns:

Direction in numeric.

getPlayerDirection

public static double getPlayerDirection(java.lang.String playerID)

Gets the direction of the Player.

Parameters:

playerID - PlayerID in String

Returns:

Direction in numeric.

Chapter 2 eXplo Lua Script System API Reference 53

Page 56: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getNpcDirection

public static double getNpcDirection(java.lang.String npcName)

Gets the direction of the NPC.

Parameters:

npcName - Name of NPC

Returns:

Direction in numeric

getPlayerByPID

public static com.explo.features.script.vm.LuaTable getPlayerByPID(java.lang.String pid)

Gets the Player table of the Player. the table may contains the Nick name and PlayerID.

Parameters:

pid - PlayerID in String

Returns:

Lua-Table can be reached by using playerid and nickname as the suffix.

getPlayerByName

public static com.explo.features.script.vm.LuaTable getPlayerByName(java.lang.String name)

Gets the Player table of the Player. the table may contains the Nick name and PlayerID.

Parameters:

name - Name of the Player

Returns:

Lua-Table can be reached by using playerid and nickname as the suffix.

54 Class Explo3D

Page 57: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getNpcByName

public static com.explo.features.script.vm.LuaTablegetNpcByName(java.lang.String name)

Gets the NPC table. the table may contains the nickname and position and direction.

Parameters:

name - Name of the NPC

Returns:

Lua-Table can be reached by using nickname and position and direction as the suffix.

getRadarPlayer

public static com.explo.features.script.vm.LuaTable getRadarPlayer()

Gets all Players in radar area, the result may contain lots of Players, each single result can be reached by using numeric from 1 to #table. each result may contains:nickname,playerid,direction,position.

Returns:

Lua-table.

getRadarNpc

public static com.explo.features.script.vm.LuaTable getRadarNpc()

Gets all NPC in radar area, the result may contain lots of NPC, each single result can be reached by using numeric from 1 to #table. each result may contains:nickname,direction,position

Returns:

Lua-table.

setCameraMode

public static void setCameraMode(int mode)

Chapter 2 eXplo Lua Script System API Reference 55

Page 58: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Sets the 3D camera to a allowed mode: DEFAULT_VIEW = 0; BACK_VIEW = 1; FIRSTPERSON_VIEW = 2;

Parameters:

mode - the camera mode

setCameraDistance

public static void setCameraDistance(double distance)

Sets the distance between the avatar and camera.

Parameters:

distance - distance in numeric

setCameraHeight

public static void setCameraHeight(double height)

Sets the camera height.

Parameters:

height - height in numeric

setAvatarHeight

public static void setAvatarHeight(int height)

Sets the height of avatar.

Parameters:

height - height in numeric.

setChatCameraMode

public static void setChatCameraMode(double x, double y, double z)

Sets the camera to a extension mode of CHAT_VIEW = 3; this mode is require a face to face chat target position. Note: this functionality is available for 2 players face to face chat only.

56 Class Explo3D

Page 59: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Parameters:

x - x coordinate of another chat player

y - y coordinate of another chat player

z - z coordinate of another chat player

Chapter 2 eXplo Lua Script System API Reference 57

Page 60: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib

Class ExploHttpjava.lang.Object

com.explo.features.script.gmtlib.ExploHttp

public class ExploHttp

extends java.lang.Object

ExploHttp is a factory for creating new Connection objects. The creation of Connections is performed dynamically by looking up a protocol implementation class whose name is formed from the platform name (read from a system property) and the protocol name of the requested connection (extracted from the parameter string supplied by the application programmer.) The parameter string that describes the target should conform to the URL format as described in RFC 2396. This takes the general form: {scheme}:[{target}][{params}] where {scheme} is the name of a protocol such as http. } The {target} is normally some kind of network address. Any {params} are formed as a series of equates of the form ";x=y". Example: ";type=a".

Constructor SummaryExploHttp ()

Method Summary

booleanclose() Close the connection.

java.lang.StringgetHeaderField(java.lang.String key) Returns the value of the named header field.

java.lang.StringgetHost() Returns the host information of the URL of this connection.

intgetPort() Returns the network port number of the URL for this HttpConnection.

java.lang.StringgetProtocol() Returns the protocol name of the URL of this Connection.

java.lang.StringgetQuery() Returns the query portion of the URL of this Connection.

java.lang.StringgetRequestMethod() Get the current request method.

58 Class ExploHttp

Page 61: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

java.lang.StringgetRequestProperty(java.lang.String key) Returns the value of the named general request property for this connection.

intgetResponseCode() Returns the HTTP response status code.

java.lang.StringgetURL() Return a string representation of the URL for this connection.

static ExploHttpopen(java.lang.String name) Create and open a connection.

static ExploHttpopen(java.lang.String name, int mode) Create and open a connection with the access mode.

static ExploHttpopen(java.lang.String name, int mode, boolean timeout) Create and open a Connection with access mode.

com.explo.features.script.io.

DataInputStream

openDataInputStream() Open and return a data input stream for a connection.

com.explo.features.script.io.

DataOutputStream

openDataOutputStream() Open and return a data output stream for a connection.

voidsetRequestMethod(java.lang.String method) Set the method for the URL request, one of: GET POST HEAD

voidsetRequestProperty(java.lang.String key, java.lang.String value) Sets the general request property.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Summary

Chapter 2 eXplo Lua Script System API Reference 59

Page 62: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

ExploHttp

public ExploHttp()

open

public static ExploHttp open(java.lang.String name)

Create and open a connection.

Parameters:

name - The URL for the connection.

Returns:

A LuaTable will be returned, which will represents the new Connection that created by native.

open

public static ExploHttp open(java.lang.String name, int mode)

Create and open a connection with the access mode. The access mode may allowed with: READ = 1, WRITE = 2, READ_WRITE = 3

Parameters:

name - The URL for the connection.

mode - access mode.

Returns:

A LuaTable will be returned, which will represents the new Connection that created by native.

Constructor Detail

Method Detail

60 Class ExploHttp

Page 63: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

open

public static ExploHttp open(java.lang.String name, int mode, boolean timeout)

Create and open a Connection with access mode and timeout.

Parameters:

name - The URL for the connection.

mode - access mode.

timeout - A flag to indicate that the caller wants timeout connection.

Returns:

A LuaTable will be returned, which will represents the new Connection that created by native.

close

public boolean close()

Close the connection.

getURL

public java.lang.String getURL()

Return a string representation of the URL for this connection.

Returns:

The string representation of the URL for this connection.

getProtocol

public java.lang.String getProtocol()

Returns the protocol name of the URL of this Connection.

Returns:

The protocol of the URL of this Connection.

Chapter 2 eXplo Lua Script System API Reference 61

Page 64: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getHost

public java.lang.String getHost()

Returns the host information of the URL of this Connection. e.g. host name or IPv4 address

Returns:

The host information of the URL of this Connection.

getQuery

public java.lang.String getQuery()

Returns the query portion of the URL of this Connection. RFC2396 defines the query component as the text after the first question-mark (?) character in the URL.

Returns:

The query portion of the URL of this Connection. Null is returned if there is no value.

getPort

public int getPort()

Returns the network port number of the URL for this HttpConnection.

Returns:

The network port number of the URL for this HttpConnection. The default HTTP port number (80) is returned if there was no port number in the string passed to Connector.open.

getRequestMethod

public java.lang.String getRequestMethod()

Get the current request method. e.g. HEAD, GET, POST The default value is GET.

Returns:

The HTTP request method.

62 Class ExploHttp

Page 65: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

setRequestMethod

public boolean setRequestMethod(java.lang.String method)

Set the method for the URL request, one of: GET POST HEAD

Parameters:

method - the HTTP method

Returns:

getRequestProperty

public java.lang.String getRequestProperty(java.lang.String key)

Returns the value of the named general request property for this connection.

Parameters:

key - The keyword by which the request property is known (e.g., "accept").

Returns:

The value of the named general request property for this connection. If there is no key with the specified name then null is returned.

setRequestProperty

public boolean setRequestProperty(java.lang.String key,

java.lang.String value)

Sets the general request property. If a property with the key already exists, overwrite its value with the new value.

Parameters:

key - the keyword by which the request is known (e.g., "accept").

value - the value associated with it.

getResponseCode

public int getResponseCode()

Chapter 2 eXplo Lua Script System API Reference 63

Page 66: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Returns the HTTP response status code. It parses responses like: HTTP/1.0 200 OK HTTP/1.0 401 Unauthorized

Returns:

The HTTP Status-Code or -1 if no status code can be discerned.

getHeaderField

public java.lang.String getHeaderField(java.lang.String key)

Returns the value of the named header field.

Parameters:

key - The Key of a header field.

Returns:

The value of the named header field, or null if there is no such field in the header.

openDataOutputStream

public DataOutputStream openDataOutputStream()

Open and return a data output stream for a connection.

Returns:

A LuaTable will be returned, which will represents the output stream that opened by native.

openDataInputStream

public DataInputStream openDataInputStream()

Open and return a data input stream for a connection.

Returns:

A LuaTable will be returned, which will represents the output stream that opened by native.

64 Class ExploHttp

Page 67: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib

Class ExploUIjava.lang.Object

com.explo.features.script.gmtlib.ExploUI

public class ExploUI

extends java.lang.Object

The ExploUI class provides a basis of UI management system. It is responsible to maintain Window instance to schedule paint event and dispatch key event...

Constructor SummaryExploUI ()

Method Summary

static voidaddWindow(Window w) Add a window to the management list

staticcom.explo.features.

script.gmtlib.Window

createWindow(int width, int height) Create a window area with the given size.

staticcom.explo.features.

script.gmtlib.Window

createWindow(int x, int y, int width, int height) Create a window area with the given size and coordinates.

static void

drawBox(int width, int height) Draw a Explo standard UI frame.which can not be modified by the script the default margin of with and height are 8 pixel size.

static void

drawBox(int x, int y, int width, int height) Draw a Explo standard UI frame.which can not be modified by the script the default margin of with and height are 8 pixel size.

static intgetGameCode(int keyCode) Convert the Key-code to the Game-code.

static intgetHeight() Gets the height of the view.

static intgetLeftCmdKey() Return the Keycode of LEFT COMMAND KEY

static intgetRightCmdKey() Return the Keycode of RIGHT COMMAND KEY

Chapter 2 eXplo Lua Script System API Reference 65

Page 68: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

ExploUI

public ExploUI()

createWindow

public static Window createWindow(int width, int height)

static intgetWidth() Gets the width of the view.

static voidhideWindow(Window w) Sets the window be hidden.

static void

inputText(com.explo.features.script.vm.Closure closure, java.lang.String title, java.lang.String value, int maxlength, int type) Request to input some text from High level User Interface, the result will be returned to the given closure.

static voidremoveAllWindows() Remove all contained window from management list.

static voidremoveWindow(Window w) Remove a window from the management list.

static voidshowWindow(Window w) Sets the window can be show from the management list.

staticjava.lang.String[]

wordWrap(java.lang.String text, Font font, int maxWidth)The wordWrap is a fast word-wrap utility, which is used to split the text contents to a string array, the split rule will based on the given Width and language settings in JAD file.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Method Detail

Method Summary

66 Class ExploUI

Page 69: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Create a window area with the given size. Once the window created, the coordinate may move to the center.

Parameters:

width - width of new window in pixel.

height - height of new window in pixel.

Returns:

A LuaTable will be returned, which will represents the new window that created by native.

createWindow

public static Window createWindow(int x,

int y,

int width,

int height)

Create a window area with the given size and coordinates.

Parameters:

x -

y -

width - width of new window in pixel.

height - height of new window in pixel.

Returns:

A LuaTable will be returned, which will represents the new window that created by native.

getWidth

public static int getWidth()

Gets the width of the view.

Chapter 2 eXplo Lua Script System API Reference 67

Page 70: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Returns:

The width of the view.

getHeight

public static int getHeight()

Gets the height of the view.

Returns:

The height of the view.

addWindow

public static void addWindow(Window w)

Add a window to the management list.

Parameters:

w - A LuaTable need be provided, which may represents the window instance.

showWindow

public static void showWindow(Window w)

Sets the window can be show from the management list.

Parameters:

w - A LuaTable need be provided, which may represents the window instance.

hideWindow

public static void hideWindow(Window w)

Sets the window be hidden.

Parameters:

w - A LuaTable need be provided, which may represents the window instance.

68 Class ExploUI

Page 71: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

removeWindow

public static void removeWindow(Window w)

Remove a window from the management list

Parameters:

w - A LuaTable need be provided, which may represents the window instance.

removeAllWindows

public static void removeAllWindows()

Remove all contained window from management list.

getLeftCmdKey

public static int getLeftCmdKey()

Return the Keycode of LEFT COMMAND KEY

Returns: The Key code with an integer number.

getRightCmdKey

public static int getRightCmdKey()

Return the Keycode of RIGHT COMMAND KEY

Returns: The Key code with an integer number.

getGameCode

public static int getGameCode(int keyCode)

Convert the Key-code to the Game-code

Returns:The game code.

Chapter 2 eXplo Lua Script System API Reference 69

Page 72: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

drawBox

public static int drawBox(int width, int height)

Draw an Explo standard UI frame which can not be modified by the script the default margin of with and height are 8 pixel size.

drawBox

public static int drawBox(int x, int y, int width, int height)

Draw an Explo standard UI frame which can not be modified by the script the default margin of with and height are 8 pixel size.

wordWrap

public static java.lang.String[] wordWrap(java.lang.String text, Font font, int maxWidth)

The wordWrap is a fast word-wrap utility, which is used to split the text contents to a string array, the split rule will based on the given Width and language settings in JAD file.

Parameters:

text - the Text content.

font - Font for check size

maxWidth - The content will be split and stored in the next index of array when the maxWidth is reached by the text content.

Returns:

A LuaTable will be returned, which will presents the String array of wordWraped text contents.

70 Class ExploUI

Page 73: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib

Class JERjava.lang.Object

com.explo.features.script.gmtlib.JER

public class JER

extends java.lang.Object

JER

public JER()

decode

public com.explo.features.script.vm.LuaTable decode(DataInputStream is,

java.lang.String[] schema1, java.lang.String[] schema2,java.lang.String[] schema3)

Constructor SummaryJER()

Method Summary

com.explo.features.script.vm.LuaTable

decode(DataInputStream is, java.lang.String[] schema1, java.lang.String[] schema2, java.lang.String[] schema3) Decode the Jer data from a DataInputStream.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Method Detail

Chapter 2 eXplo Lua Script System API Reference 71

Page 74: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Decode the Jer data from a DataInputStream.

Parameters:

is -

schema1 - The schema structure which need defined by Server, if there is no optional schema, please ignore the 2nd and 3rd parameters.

schema2 - The schema structure which need defined by Server, the optional schema list.

schema3 - The schema structure which need defined by Server, the optional schema list. this is not the last schema but just a sample, which is support unlimited number of parameters if necessary, the more parameters will not in the list

Returns:

The schema data will be returned in a table, the detailed single data is a table as well that nested in the returned one.

72 Class JER

Page 75: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib

Class Sessionjava.lang.Object

com.explo.features.script.gmtlib.Session

public class Session

extends java.lang.Object

Constructor SummarySession()

Method Summary

voidclose() Close the current session.

com.explo.features.script.vm.LuaTable

getMembers() Gets the members that in the current interaction group.

java.lang.String

invite(java.lang.String playerId) Invite a player to join current session, The session will be created if it's not yet been started, meanwhile the InteractionId will be acquired from server when the session is created.

static Session open(java.lang.String type)

java.lang.String

reply(java.lang.String interactinType, java.lang.String interactionId, java.lang.String answer, java.lang.String playerId) When an invitation comes in, use this method to answer the invitation asynchronism since multiple invitations can be received on the invitee side.

java.lang.Stringsend(java.lang.String message) Send the message to an established interaction.

java.lang.Stringsend(java.lang.String message, java.lang.String URLparameter) Send the message to an established interaction.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Chapter 2 eXplo Lua Script System API Reference 73

Page 76: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Session

public Session()

open

public static Session open(java.lang.String type)

Parameters:

type -

Returns:

A LuaTable will be returned, which will represents the instance of Session created.

close

public void close()

Close the current session.

invite

public java.lang.String invite(java.lang.String playerId)

Invite a player to join current session, The session will be created if it's not yet been started, meanwhile the InteractionId will be acquired from server when the session is created.

Parameters:

playerId -

Returns:

The result of the invitation sent.

Constructor Detail

Method Detail

74 Class Session

Page 77: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

invite

public java.lang.String invite(java.lang.String playerId,

java.lang.String InviteMsg)

Invite a player to join current session, The session will be created if it's not yet been started, meanwhile the InteractionId will be acquired from server when the session create.

Parameters:

playerId - The playerId of the invitee, which is an unique number generated by the eXplo system.

InviteMsg - The invite message that will be delivered to the invitee side.

Returns:

The result of the invitation sent.

reply

public java.lang.String reply(java.lang.String interactinType, java.lang.String interactionId, java.lang.String answer, java.lang.String playerId)

When an invitation comes in, use this method to answer the invitation asynchronistically, since the multiple invitation can be received on the invitee side. You need to indicate which detailed invitation you are going to reply to at the time.

Parameters:

interactinType - The interaction type of the invitation you are going to answer. interactionId - The interaction Id of the invitation you are going to answer. answer - The answer can be "yes" for accept, "no" for decline, "busy" for decline partial of interaction type. playerId - The playerId of the inviter.

Returns:

The result of the answer replied.

send

public java.lang.String send(java.lang.String message)

Chapter 2 eXplo Lua Script System API Reference 75

Page 78: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Return the horizontal position of the window.

Returns:

The horizontal position in pixel.

send

public java.lang.String send(java.lang.String message,

java.lang.String URLparameter)

Return the width of the window in pixel.

Returns:

The width of the window in pixel.

getMembers

public com.explo.features.script.vm.LuaTable getMembers()

Gets the members in the current interaction group.

Returns:

A LuaTable will be returned which may include the playerid and nickname information in the list.

76 Class Session

Page 79: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib

Class Windowjava.lang.Object

com.explo.features.script.gmtlib.Window

public class Window

extends java.lang.Object.

The Window provides the basis UI facility that allow users to define they own graphic contents.

Constructor SummaryWindow()

Method Summary

intgetHeight() Return the height of the window in pixel.

intgetWidth() Return the width of the window in pixel.

intgetX() Return the horizontal position of the window.

intgetY() Return the vertical position of the window.

booleanisVisible() Check whether this window is visible.

voidrepaint() Request to repaint this window.

voidrepaint(int x, int y, int width, int height) Request to repaint some part of this window.

void

setListener(com.explo.features.script.vm.Closure closure, java.lang.String type) Register the Event callback associated with this window.

voidsetX(int x) Sets the x coordinate of the window.

voidsetY(int y) Sets the y coordinate of the window.

Chapter 2 eXplo Lua Script System API Reference 77

Page 80: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Window

public Window()

getWidth

public int getWidth()

Return the width of the window in pixel.

Returns:

The width of the window in pixel.

getHeight

public int getHeight()

Return the height of the window in pixel.

Returns:

The height of the window in pixel.

getX

public int getX()

Return the horizontal position of the window.

Returns:

The horizontal position in pixel.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Method Detail

78 Class Window

Page 81: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

setX

public void setX(int x)

Sets the x coordinate of the window.

Parameters:

x - The x coordinate in pixel.

getY

public int getY()

Return the vertical position of the window.

Returns:

The vertical position in pixel.

setY

public void setY(int y)

Sets the y coordinate of the window.

Parameters:

y -The y coordinate in pixel.

isVisible

public boolean isVisible()

Check whether this window is visible.

Returns:

Returns true if visible, otherwise false.

setListener

public void setListener(com.explo.features.script.vm.Closure

closure, java.lang.String type)

Chapter 2 eXplo Lua Script System API Reference 79

Page 82: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Register the Event callback associated with this window. the Event type are allowed from the list of: PAINT, KEY_PRESS, KEY_RELEASE, COMMAND_CLICK Note: the COMMAND_CLICK will not be supported. if CP want to use the command event, CP has to control the render by.

Parameters:

closure - The event call-back function

type - The Event type.

repaint

public void repaint()

Request to repaint this window.

repaint

public void repaint(int x,int y,int width,int height)

Request to repaint some part of this window.

repaintAll

public void repaintAll()

Request to repaint the whole screen.

80 Class Window

Page 83: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib.ui

Class GridBasejava.lang.Object

com.explo.features.script.gmtlib.ui.GridBase

public abstract class GridBase

extends java.lang.Object

GridBase is the super class of the Grid-based-layout, which contains the most of variables and methods, which it is useful to the subclasses..

GridBase

public GridBase()

Constructor SummaryGridBase ()

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Chapter 2 eXplo Lua Script System API Reference 81

Page 84: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib.ui

Class GridLayoutjava.lang.Object

com.explo.features.script.gmtlib.ui.GridLayout

public class GridLayout

extends java.lang.Object

Constructor SummaryGridLayout ()

Method Summary

intgetColumns () Returns the columns of the layout.

intgetHgap() Returns the horizonal gap of the layout.

getLayout(int idx) Gets a sublayout from the current layout.

intgetNumOfItems() Returns the number of item referenced by the layout.

intgetRowMaxHeight() Gets the max height of the items in one row.

intgetRowMaxWidth() Gets the max width of the items in one row.

intgetRows() Returns the rows of the layout.

int[]getShrinkWH() getShrinkWH is used for only if the size of all the items whose size is less than the screen size.

intgetSingleMaxHeight() Gets the max height from the items.

intgetSingleMaxWidth() Gets the max width from the items.

intgetSumRowHeight() Gets the sum of the height in one rows, which is up to the idiographic layout implementation.

intgetSumRowWidth() Gets the sum of the width in one rows, which is up to the idiographic layout implementation.

intgetVgap() Returns the vertical gap of the layout.

82 Class GridLayout

Page 85: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

GridLayout

public GridLayout()

setFixedSize

public void setFixedSize(boolean bool)

Sets a boolean value for indicate whether we will using the fixed size(width/height) to lays the items. if the value is false, it is means that we will not using a fixed

voidlayoutItems(int prefreredWidth, int preferedHeight, java.util.Vector itemList)

voidsetColumns(int cols) Sets the columns of the layout.

voidsetFixedSize(boolean bool) Sets a boolean value for indicate whether we will using the fixed size(width/height) to lays the items.

voidsetHgap(int hgap) Sets the horizonal gap to the current layout.

void

setLayout(int index, com.explo.features.script.gmtlib.ui.GridBase layout) Insert a sub layout to the current one, after a layout inserted, we will using the sublayout to calcuate the items' coordinates instead of the default layout.

voidsetRows(int rows) Sets the row of the layout.

voidsetVgap(int vgap) Sets the vertical gap to the current layout.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Method Detail

Method Summary

Chapter 2 eXplo Lua Script System API Reference 83

Page 86: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

size to lays the items, in that case, we will using a maxWidth/maxHeight(the biggest item's size) to limitation the items. if the boolean value is true, it is means that we will using a fixed size to lays out all the items.

Parameters:

bool -

layoutItems

public void layoutItems(int prefreredWidth,int preferedHeight, java.util.Vector itemList)

getShrinkWH

public int[] getShrinkWH()

Used for only if the size of all the items whose size is less than the screen size. if all the items whose sum value of the width or height is bigger than the screen size we will using the whole screen size to instead of the actual size, it is for the reasons of a Window whose size have to limited to not bigger than the screen size.

Returns:

The width and height within a integer array.

getRows

public int getRows()

Returns the rows of the layout.

getColumns

public int getColumns()

Returns the columns of the layout.

getHgap

public int getHgap()

Returns the horizonal gap of the layout.

84 Class GridLayout

Page 87: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getVgap

public int getVgap()

Returns the vertical gap of the layout.

setHgap

public void setHgap(int hgap)

Sets the horizonal gap to the current layout.

Parameters:

hgap -

setVgap

public void setVgap(int vgap)

Sets the vertical gap to the current layout.

Parameters:

vgap -

setRows

public void setRows(int rows)

Sets the row of the layout. This method must invoked before sets the layout to the ItemManager. Since the layout been specified to the ItemManager, this method has no affect on the existed data.

Parameters:

rows -

setColumns

public void setColumns(int cols)

Sets the columns of the layout. this method must invoked before sets the layout to the ItemManager. since the layout been specified to the ItemManager, this method is no affects to the existed datas

Chapter 2 eXplo Lua Script System API Reference 85

Page 88: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Parameters:

cols -

getSingleMaxWidth

public int getSingleMaxWidth()

Gets the max width from the items.

getSingleMaxHeight

public int getSingleMaxHeight()

Gets the max height from the items.

getRowMaxWidth

public int getRowMaxWidth()

Gets the max width of the items in one row.

getRowMaxHeight

public int getRowMaxHeight()

Gets the max height of the items in one row.

getSumRowWidth

public int getSumRowWidth()

Gets the sum of the width in one rows, which is up to the idiographic layout implementation.

getSumRowHeight

public int getSumRowHeight()

Gets the sum of the height in one rows, which is up to the idiographic layout implementation.

86 Class GridLayout

Page 89: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getLayout

public com.explo.features.script.gmtlib.ui.GridBase getLayout(int idx)

Gets a sublayout from the current layout.

Parameters:

idx - Index of the nested layout.

setLayout

public void setLayout(int index, com.explo.features.script.gmtlib.ui.GridBase layout)

Insert a sub-layout to the current one. After a layout is inserted, we will use the sub-layout to calcuate the items' coordinates instead of the default layout. The grid index must be between 0 and rows * cols.

Parameters:

index -

layout -

getNumOfItems

public int getNumOfItems()

Returns the number of item referenced by the layout. the numer contains number of item refered by his sublayout.

Chapter 2 eXplo Lua Script System API Reference 87

Page 90: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib.ui

Class ScrollDialogjava.lang.Object

com.explo.features.script.gmtlib.ui.ScrollDialog

public class ScrollDialog

extends java.lang.Object

Constructor SummaryScrollDialog ()

Method Summary

voidaddCmd(com.explo.features.script.vm.LuaTable t) Adds a command to the ScrollDialog

voidaddItem(com.explo.features.script.gmtlib.ui.items.Item item) Adds an Item into the ScrollDialog.

voidbackFocus() Sets the previous item on focus.

voidenableScrollbar(boolean enable) Sets the scroll bar can be shown or not.

voidforwardFocus() Sets the next item on focus.

intgetCurrentItemIndex() Returns the index number of an element in the List that is selected.

intgetHeight() Return the height of the window in pixel.

com.explo.features.script.gmtlib.ui.

items.Item

getItem(int index) Gets the item at given position

intgetItemsCnt() Gets the number of items in the ScrollDialog

java.lang.StringgetTitle() Gets the title of the Displayable.

intgetWidth() Return the width of the window in pixel.

intgetX() Return the horizontal position of the window.

88 Class ScrollDialog

Page 91: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

intgetY() Return the vertical position of the window.

booleanisVisible() Check whether this window is visible.

voidremoveAllCmd() Removes all the commands from the ScrollDialog.

voidremoveAllItems() Removes all the items in the ScrollDialog.

voidremoveCmd(com.explo.features.script.vm.LuaTable t) Removes a command from the ScrollDialog.

voidrepaint() Request to repaint this window.

voidrepaint(int x, int y, int width, int height) Request to repaint some part of this window.

voidrepaintAll() Request to repaint the whole screen.

voidresetScrollHeight() Resets the height of ScrollDialog.

voidsetFocus(int index) Sets the Focused Item by use the giving one.

voidsetHighLightFocus(boolean bool) Set whether need to paint a rectangle surrand the focused item.

voidsetItems() This method should be called when all the items are added and the item is added by addItem(Item item).

voidsetItems(com.explo.features.script.gmtlib.ui.items.Item[] items) Sets all Items into the Dialog.

voidsetLayout(com.explo.features.script.gmtlib.ui.GridBase layout) Sets a layout in the ScrollDialog.

void

setListener(com.explo.features.script.vm.Closure closure, java.lang.String type) Register the Event callback associated with this window.

Method Summary

Chapter 2 eXplo Lua Script System API Reference 89

Page 92: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

ScrollDialog

public ScrollDialog()

getWidth

public int getWidth()

void

setScrollbarBGColor(int bgcolor) Sets the BG of scroll bar color, sets the current color to the specified RGB values,the color component is specified in the form of 0x00RRGGBB.

void

setScrollbarBorderColor(int bordercolor) Sets the border of scroll bar color, sets the current color to the specified RGB values,the color component is specified in the form of 0x00RRGGBB.

void

setScrollbarColor(int barcolor) Sets scroll bar color, sets the current color to the specified RGB values,the color component is specified in the form of 0x00RRGGBB.

voidsetTitle(java.lang.String title) Sets the title of the ScrollDialog

voidsetX(int x) Sets the x coordinate of the window.

voidsetY(int y) Sets the y coordinate of the window.

voidupdate() This method should be called when the items are changed in the ScrollDialog.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Method Detail

Method Summary

90 Class ScrollDialog

Page 93: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Return the width of the window in pixel.

Returns:

The width of the window in pixel.

getHeight

public int getHeight()

Return the height of the window in pixel.

Returns:

The height of the window in pixel.

getX

public int getX()

Return the horizontal position of the window.

Returns:

The horizontal position in pixel.

setX

public void setX(int x)

Sets the x coordinate of the window.

Parameters:

x - The x coordinate in pixel.

getY

public int getY()

Return the vertical position of the window.

Returns:

The vertical position in pixel.

Chapter 2 eXplo Lua Script System API Reference 91

Page 94: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

setY

public void setY(int y)

Sets the y coordinate of the window.

Parameters:

y - The y coordinate in pixel.

isVisible

public boolean isVisible()

Check whether this window is visible.

Returns:

Return true if visible otherwise false.

setListener

public void setListener(com.explo.features.script.vm.Closure closure,java.lang.String type)

Register the Event callback associated with this window. the Event type are allowed from the list of: PAINT, KEY_PRESS, KEY_RELEASE, COMMAND_CLICK Note: the COMMAND_CLICK will not be supported. if CP want to use the command event, CP has to control the render by

Parameters:

closure - The event call-back function.

type - The Event type.

repaint

public void repaint()

Request to repaint this window.

repaint

public void repaint(int x, int y, int width, int height)

92 Class ScrollDialog

Page 95: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Request to repaint some part of this window.

repaintAll

public void repaintAll()

Request to repaint the whole screen.

addCmd

public void addCmd(com.explo.features.script.vm.LuaTable t)

Adds a command to the ScrollDialog.

Parameters:

t - the command to be added.

removeCmd

public void removeCmd(com.explo.features.script.vm.LuaTable t)

Removes a command from the ScrollDialog.

Parameters:

t - the command to be removed.

removeAllCmd

public void removeAllCmd()

Removes all the commands from the ScrollDialog.

getTitle

public java.lang.String getTitle()

Gets the title of the Displayable.

Returns:

The title of the instance.

Chapter 2 eXplo Lua Script System API Reference 93

Page 96: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

setTitle

public void setTitle(java.lang.String title)

Sets the title of the ScrollDialog.

Parameters:

title - the new title.

enableScrollbar

public void enableScrollbar(boolean enable)

Sets the scroll bar can be shown or not.

Parameters:

enable - if true the scroll bar will be shown, the default value is false.

setScrollbarColor

public void setScrollbarColor(int barcolor)

Sets scroll bar color, sets the current color to the specified RGB values,the color component is specified in the form of 0x00RRGGBB.

Parameters:

barcolor - the color being set

setScrollbarBGColor

public void setScrollbarBGColor(int bgcolor)

Sets the BG of scroll bar color, sets the current color to the specified RGB values,the color component is specified in the form of 0x00RRGGBB.

Parameters:

bgcolor - the color being set

setScrollbarBorderColor

public void setScrollbarBorderColor(int bordercolor)

94 Class ScrollDialog

Page 97: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Sets the border of scroll bar color, sets the current color to the specified RGB values,the color component is specified in the form of 0x00RRGGBB.

Parameters:

bordercolor - the color being set

setLayout

public void setLayout(com.explo.features.script.gmtlib.ui.GridBase layout)

Sets a layout in the ScrollDialog.

Parameters:

layout -

addItem

public void addItem(com.explo.features.script.gmtlib.ui.items.Item item)

Adds an Item into the ScrollDialog. The newly added Item becomes the last Item in the ScrollDialog, and the size of the ScrollDialog grows by one.

Parameters:

item - the Item to be added.

update

public void update()

This method should be called when the items are changed in the ScrollDialog.

resetScrollHeight

public void resetScrollHeight()

Resets the height of ScrollDialog.

setItems

public void setItems()

Chapter 2 eXplo Lua Script System API Reference 95

Page 98: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

This method should be called when all the items are added and the item is added by addItem(Item item). If items are added by setItems(Item[] items) method, this method should not be called.

getCurrentItemIndex

public int getCurrentItemIndex()

Returns the index number of an element in the List that is selected.

Returns:

The index of selected element, or -1 if none.

setItems

public void setItems(com.explo.features.script.gmtlib.ui.items.Item[] items)

Sets all Items into the Dialog.

Parameters:

items -

setHighLightFocus

public void setHighLightFocus(boolean bool)

Set whether need to paint a rectangle surrand the focused item.

Parameters:

bool -

getItemsCnt

public int getItemsCnt()

Gets the number of items in the ScrollDialog.

Returns:

The number of items.

96 Class ScrollDialog

Page 99: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

forwardFocus

public void forwardFocus()

Sets the next item on focus. If the current item is the last one, the focus item is still the last one.

backFocus

public void backFocus()

Sets the previous item on focus. If the current item is the first one, the focus item is still the first one.

setFocus

public void setFocus(int index)

Sets the Focused Item by use the giving one.

Parameters:

index -

getItem

public com.explo.features.script.gmtlib.ui.items.Item getItem(int index)

Gets the item at given position.

Parameters:

index - the index of item

Returns:

The item at the given position.

removeAllItems

public void removeAllItems()

Removes all the items in the ScrollDialog.

Chapter 2 eXplo Lua Script System API Reference 97

Page 100: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib.ui.items

Class IconItemWithBorderjava.lang.Object

com.explo.features.script.gmtlib.ui.items.IconItemWithBorder

public class IconItemWithBorder

extends java.lang.Object

Constructor SummaryIconItemWithBorder ()

Method Summary

voidcomputeSize(int maxWidth, int maxHeight) Computes the size of the UI component by using the component's known width and height.

javax.microedition.lcdui.Image

getIcon() Gets the image contained within the IconItemWithBorder, or null if there is no contained image.

java.lang.StringgetLabel() Gets the text contents of the IconItemWithBorder, or null if the IconItemWithBorderis empty.

void

setIcon(javax.microedition.lcdui.Image icon) Sets the Image object contained within the IconItemWithBorder.

voidsetLabel(java.lang.String label) Sets the label contents of the IconItemWithBorder.

Methods inherited from class com.explo.features.script.gmtlib.ui.items.Item

getAnchor, getEnable, getFocus, getHeight, getHgap, getVgap, getVisiable, getWidth, getX, getY, setAnchor, setEnable, setFocus, setLableH, setPressed, setVisiable, setX, setY

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

98 Class IconItemWithBorder

Page 101: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

IconItemWithBorder

public IconItemWithBorder()

setIcon

public void setIcon(javax.microedition.lcdui.Image icon)

Sets the Image object contained within the IconItemWithBorder.

Parameters:

icon - The Image for this ImageItem, or null if none.

getIcon

public javax.microedition.lcdui.Image getIcon()

Gets the image contained within the IconItemWithBorder, or null if there is no contained image.

Returns:

The image used by the ImageItem.

setLabel

public void setLabel(java.lang.String label)

Sets the label contents of the IconItemWithBorder. If text is null, the IconItemWithBorder is set to be empty.

Parameters:

label - The new content.

Constructor Detail

Method Detail

Chapter 2 eXplo Lua Script System API Reference 99

Page 102: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getLabel

public java.lang.String getLabel()

Gets the text contents of the IconItemWithBorder, or null if the IconItemWithBorderis empty.

Returns:

A string with the content of the item.

computeSize

public void computeSize(int maxWidth,int maxHeight)

Compute the size of the UI component by using the component's known width and height. This method is invoked automatically by an ItemManager once the UI component is inserted into the ItemManager. The result is used by the ItemManager to layout the UI component. Other items are set rightwards and downwards of this UI component.

Parameters:

maxWidth - The maxium available width of a UI component.

maxHeight - The maximum available height of a UI component.

See Also:

com.explo.features.script.gmtlib.ui.items#computeSize()

100 Class IconItemWithBorder

Page 103: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib.ui.items

Class Itemjava.lang.Object

com.explo.features.script.gmtlib.ui.items.Item

public class Item

extends java.lang.Object

BaseInfoItem is an abstract superclass of any UI component that has a graphical representation on a mobile device screens and with which a user can interact. Examples of UI components are buttons, checkboxes, text boxes, drop-down lists, and scrollbars. Note that an instance of Item is referred to as a UI component in this documentation.

Constructor SummaryItem ()

Method Summary

abstract void

computeSize(int maxWidth, int maxHeight) Compute the size of the UI component by using the component's known width and height.

intgetAnchor() Get the anchor location of the UI component.

booleangetEnable() Determine if the UI component is enabled.

booleangetFocus() Determine if the UI component is in focus or not.

intgetHeight() Get the height of the UI component and its text label.

intgetHgap() Get the horizontal space between the sub-parts of the UI component.

java.lang.StringgetLabel() Return the text label of the UI component.

intgetVgap() Get the vertical space between the sub-parts of the UI component.

booleangetVisible() Determine if the UI component is visible.

Chapter 2 eXplo Lua Script System API Reference 101

Page 104: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

intgetWidth() Get the width of the UI component and its text label.

intgetX() Get the x-coordinate of the top-left point of the UI component.

intgetY() Get the y-coordinate of the top-left point of the UI component.

voidsetAnchor(int anchor) Set the anchor position for the UI component.

voidsetEnable(boolean bool) Enable or disable the UI component.}

voidsetFocus(boolean bool) Put or remove the focus on the UI component.

voidsetLabelH() Set the iLabelLayout from LABEL_LAYOUT_VERTICAL to LABEL_LAYOUT_HORIZONTAL.

voidsetPressed(boolean bool) The pressed or unpressed state the UI component.

voidsetVisible(boolean bool) Make the UI component visible or hide it.}

voidsetX(int x) Set the x-coordinate of the top-left point of the UI component.

voidsetY(int y) Set the y-coordinate of the top-left point of the UI component.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Summary

102 Class Item

Page 105: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Item

public Item()

getX

public int getX()

Get the x-coordinate of the top-left point of the UI component.

Returns:

The x-coordinate of the point.

getY

public int getY()

Get the y-coordinate of the top-left point of the UI component.

Returns:

The y coordinate of the point.

getWidth

public int getWidth()

Get the width of the UI component and its text label.

Returns:

The width of the UI component including label.

getHeight

public int getHeight()

Get the height of the UI component and its text label.

Constructor Detail

Method Detail

Chapter 2 eXplo Lua Script System API Reference 103

Page 106: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Returns:

The height of the UI component including label.

getHgap

public int getHgap()

Get the horizontal space between the sub-parts of the UI component. For example, the horizontal space between the component's graphic and its text label.

Returns:

The horizontal space between the sub-parts of the UI component.

getVgap

public int getVgap()

Get the vertical space between the sub-parts of the UI component. For example, the vertical space between the component's graphic and its text label.

Returns:

The vertical space between the sub-parts of the UI component.

getAnchor

public int getAnchor()

Get the anchor location of the UI component. See the description for anchor.

Returns:

The UI component's anchor location.

getFocus

public boolean getFocus()

Determine if the UI component is in focus or not.

Returns:

104 Class Item

Page 107: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

A boolean value that indicates whether the UI component is in focus or not.

getEnable

public boolean getEnable()

Determine if the UI component is enabled.

Returns:

A boolean value that indicates whether the UI component is enabled or not.

getVisible

public boolean getVisible()

Determine if the UI component is visible.

Returns:

A boolean value that indicates whether the UI component is visible or not.

setX

public void setX(int x)

Set the x-coordinate of the top-left point of the UI component.

Parameters:

x - The integer value of the x-coordinate.

setY

public void setY(int y)

Set the y-coordinate of the top-left point of the UI component.

Parameters:

y - The integer value of the y-coordinate.

setFocus

public void setFocus(boolean bool)

Chapter 2 eXplo Lua Script System API Reference 105

Page 108: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Put or remove the focus on the UI component.

Parameters:

bool - A boolean value that indicates whether the UI component is in focus or not.

setEnable

public void setEnable(boolean bool)

Enable or disable the UI component.}

Parameters:

bool - A boolean value that indicates whether the UI component is enabled or not.

setPressed

public void setPressed(boolean bool)

The pressed or unpressed state the UI component.

Parameters:

bool - A boolean value that indicates whether the UI component is pressed or not.

setVisible

public void setVisible(boolean bool)

Make the UI component visible or hide it.

Returns:

A boolean value that indicates whether the UI component is visible or hidden.

setAnchor

public void setAnchor(int anchor)

Set the anchor position for the UI component. See also the description for anchor.}

106 Class Item

Page 109: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Parameters:

anchor - The integer value of the anchor position.

setLabelH

public void setLableH()

Set the iLabelLayout from LABEL_LAYOUT_VERTICAL to LABEL_LAYOUT_HORIZONTAL. The default is LABEL_LAYOUT_VERTICAL. See the description for iLabelLayout for an example.

getLabel

public java.lang.String getLabel()

Returns the text label of the UI component.

Returns:

The UI component's text label.

computeSize

public abstract void computeSize(int maxWidth, int maxHeight)

Compute the size of the UI component by using the component's known width and height. This method is invoked automatically by an ItemManager once the UI component is inserted into the ItemManager. The result is used by the ItemManager to layout the UI component. Other items are set rightwards and downwards of this UI component.

Parameters:

maxWidth - The maxium available width of a UI component.

maxHeight - The maximum available height of a UI component.

Chapter 2 eXplo Lua Script System API Reference 107

Page 110: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib.ui.itemss

Class StringInfoItemjava.lang.Object

com.explo.features.script.gmtlib.ui.items.Itemcom.explo.features.script.gmtlib.ui.items.StringInfoItem

public class StringInfoItem

com.explo.features.script.gmtlib.ui.items.Item

StringInfoItem is a subclass which inherits from BaseInfoItem. It contains an image icon and/or a string label.

Constructor SummaryStringInfoItem ()

Method Summary

void

computeSize(int maxWidth, int maxHeight) Compute the size of the UI component by using the component's known width and height.

javax.microedition.lcdui.Image

getImage() Returns the Image ojbect.

java.lang.StringgetLabel() Returns the label contents.

javax.microedition.lcdui.Font

getLabelFont() Returns the Font Object that been used for rendering the labels.

voidsetGap(int vgap, int hgap) Sets the gap for keep a distance between string label and Image.

voidsetLabel(java.lang.String s) Sets the label contents.

voidsetLabelColor(int color) Sets the color value for the string label.

voidsetLabelFont(javax.microedition.lcdui.Font f) Sets the Font for the label.

108 Class StringInfoItem

Page 111: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

StringInfoItem

public StringInfoItem()

GetLabel

public java.lang.String getLabel()

Returns the label contents.

Returns:

setLabel

public void setLabel(java.lang.String s)

Sets the label contents.

getLabelFont

public javax.microedition.lcdui.Font getLabelFont()

Returns the Font Object used for rendering the labels.

Methods inherited from class com.explo.features.script.gmtlib.ui.items.Item

getAnchor, getEnable, getFocus, getHeight, getHgap, getLabel, getVgap, getVisiable, getWidth, getX, getY, setAnchor, setEnable, setFocus, setLableH, setPressed, setVisiable, setX, setY

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Method Detail

Chapter 2 eXplo Lua Script System API Reference 109

Page 112: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Returns:

setLabelFont

public void setLabelFont(javax.microedition.lcdui.Font f)

Sets the Font for the label.

Parameters:

f - A reference of the Font.

setGap

public void setGap(int vgap, int hgap)

Sets the gap for keep a distance between string label and Image. This method is only in effect before it been sets into the layout.

Parameters:

vgap - Vertical gap size.

hgap - Horzinal gap size.

getImage

public javax.microedition.lcdui.Image getImage()

Returns the Image object.

Returns:

A reference of the Image. A null will return if you do not specified any image for this item.

setLabelColor

public void setLabelColor(int color)

Sets the color value for the string label.

Parameters:

color - A color value.

110 Class StringInfoItem

Page 113: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

computeSize

public void computeSize(int maxWidth, int maxHeight)

Compute the size of the UI component by using the component's known width and height. This method is invoked automatically by an ItemManager once the UI component is inserted into the ItemManager. The result is used by the ItemManager to layout the UI component. Other items are set rightwards and downwards of this UI component.

Parameters:

maxWidth - The maxium available width of a UI component.

maxHeight - The maximum available height of a UI component.

See Also:

com.explo.features.script.gmtlib.ui.items#computeSize()

Chapter 2 eXplo Lua Script System API Reference 111

Page 114: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.gmtlib.ui.items

Class TextFieldItemjava.lang.Object

com.explo.features.script.gmtlib.ui.items.Itemcom.explo.features.script.gmtlib.ui.items.TextFieldItem

public class TextFieldItem

extends com.explo.features.gmtlib.ui.Items

A class that looks at an item and has input and display text ability.

Constructor SummaryTextFieldItem ()

Method Summary

voidcomputeSize(int maxWidth, int maxHeight) Compute the size of the UI component by using the component's known width and height.

java.lang.StringgetInput() Get inputed string of this textfield

java.lang.StringgetText() Get display content of this textfield

voidsetAlignMode(int mode) Set align mode of display.

voidsetBorder(boolean b) Set has border flag.

void setContentColor(int c)

voidsetFont(javax.microedition.lcdui.Font f ) set font of content

voidsetInputBoxTitle(java.lang.String s) Sets the title of the inputbox for the TextFieldItem.

voidsetInputScreenTitle(java.lang.String t) set title of input screen

voidsetLabel(java.lang.String label) Set lable of this textfield

voidsetMask(boolean b) Set need-mask flag.

void

setPreScreen(javax.microedition.lcdui.Displayable da) When selected a textfield and want to type something, the program will go to TextBox which it is high level UI component.

112 Class TextFieldItem

Page 115: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

TextFieldItem

public TextFieldItem()

setInputBoxTitle

public void setInputBoxTitle(java.lang.String s)

Sets the title of the inputbox for the TextFieldItem.

Parameters:

s -

setPreScreen

public void setPreScreen (javax.microedition.lcdui.Displayable da)

voidsetText(java.lang.String text) Set display content of this textfield.

voidshowInputScreen() Turn to input screen.

Methods inherited from class com.explo.features.script.gmtlib.ui.items.Item

getAnchor, getEnable, getFocus, getHeight, getHgap, getLabel, getVgap, getVisiable, getWidth, getX, getY, setAnchor, setEnable, setFocus, setLableH, setPressed, setVisiable, setX, setY

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Method Detail

Method Summary

Chapter 2 eXplo Lua Script System API Reference 113

Page 116: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

When selecting a textfield to type something, the program will go to the TextBox which is a high level UI component. If the screen needs to return to the pre-screen, it needs to know the pre-displayed instance.

Parameters:

da - Instance of the displayed

setAlignMode

public void setAlignMode(int mode)

Sets align mode of display.

Parameters:

mode - MIDP standard constants.

setBorder

public void setBorder(boolean b)

Sets border flag.

Parameters:

b - True if it has been set, false if it has not.

setMask

public void setMask(boolean b)

Sets mask flag.

Parameters:

b - True if it has been set, false if it has not.

setFont

public void setFont(javax.microedition.lcdui.Font f)

Sets font of content.

Parameters:

114 Class TextFieldItem

Page 117: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

f -

setContentColor

public void setContentColor(int c)

setInputScreenTitle

public void setInputScreenTitle(java.lang.String t)

Sets the title of input screen.

Parameters:

t -

getInput

public java.lang.String getInput()

Gets inputed string of this textfield.

Returns:

showInputScreen

public void showInputScreen()

Turn to input screen.

computeSize

public void computeSize(int maxWidth, int maxHeight)

Computes the size of the UI component by using the component's known width and height. This method is invoked automatically by an ItemManager once the UI component is inserted into the ItemManager. The result is used by the ItemManager to layout the UI component. Other items are set rightwards and downwards of this UI component.

Parameters:

maxWidth - The maxium available width of a UI component.

Chapter 2 eXplo Lua Script System API Reference 115

Page 118: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

maxHeight - The maximum available height of a UI component.

See Also:

com.explo.features.script.gmtlib.ui.items#computeSize()

setLabel

public void setLabel(java.lang.String label)

Sets label of this textfield

Parameters:

label -

setText

public void setText(java.lang.String text)

Sets display content of this textfield.

Parameters:

text -

getText

public java.lang.String getText()

Gets the displayed content of this textfield.

Returns:

116 Class TextFieldItem

Page 119: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Package com.explo.features.script.ioThe classes for com.explo.features.script.io include:

■ Class DataInputStream‚ on page 118

■ Class DataOutputStream‚ on page 126

Chapter 2 eXplo Lua Script System API Reference 117

Page 120: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.io

Class DataInputStreamjava.lang.Object

com.explo.features.script.io.DataInputStream

public class DataInputStream

extends java.lang.Object

The DataInputString interface provides for reading bytes from a binary stream and reconstructing from them data in any of the Java primitive types. There is also a facility for reconstructing a String from data in Java modified UTF-8 format.

Constructor SummaryDataInputStream()

Method Summary

int

available() Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.

voidclose() Closes this input stream and releases any system resources associated with the stream.

voidmark(int n) Marks the current position in this input stream.

voidmarkSupported() Tests if this input stream supports the mark and reset methods.

intread() Reads the next byte of data from the input stream.

com.explo.features.script.vm.LuaTable

read(int len) Reads up to len bytes of data from the input stream

booleanreadBoolean() Reads one input byte and returns true if that byte is nonzero, false if that byte is zero.

bytereadByte() Reads and returns one input byte.

charreadChar() Reads an input char and returns the char value.

doublereadDouble() Reads eight input bytes and returns a double value

118 Class DataInputStream

Page 121: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

DataInputStream

public DataInputStream()

floatreadFloat() Reads four input bytes and returns a float value.

byte[]readFully(int len) Reads up to len bytes of data from the input stream

intreadInt() Reads four input bytes and returns an int value.

longreadLong() Reads eight input bytes and returns a long value.

shortreadShort() Reads two input bytes and returns a short value.

java.lang.String readToString(int length)

int

readUnsignedByte() Reads one input byte, zero-extends it to type int, and returns the result, which is therefore in the range 0 through 255.

intreadUnsignedShort() Reads two input bytes, zero-extends it to type int, and returns an int value in the range 0 through 65535.

java.lang.StringreadUTF() Reads in a string that has been encoded using a modified UTF-8 format.

voidreset() Repositions this stream to the position at the time the mark method was last called on this input stream.

voidskip(int n) Skips over and discards n bytes of data from this input stream.

intskipBytes(int len) Reads up to len bytes of data from the input stream

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Method Summary

Chapter 2 eXplo Lua Script System API Reference 119

Page 122: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

read

public int read()

Reads the next byte of data from the input stream.

Returns:

The byte data.

read

public com.explo.features.script.vm.LuaTable read(int len)

Reads up to len bytes of data from the input stream.

Parameters:

len - the maximum number of bytes to read.

Returns:

The bytes array are returned with a LuaTable.

skip

public void skip(int n)

Skips over and discards n bytes of data from this input stream.

Parameters:

n - The maximum number of bytes to skip.

available

public int available()

Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.

Returns:

Method Detail

120 Class DataInputStream

Page 123: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

The number of bytes that can be read from this input stream without blocking.

close

public void close()

Closes this input stream and releases any system resources associated with the stream.

mark

public void mark(int n)

Marks the current position in this input stream.

Parameters:

n - The maximum limit of bytes that can be read before the mark position becomes invalid.

reset

public void reset()

Repositions this stream to the position at the time the mark method was last called on this input stream.

markSupported

public void markSupported()

Tests if this input stream supports the mark and reset methods.

readToString

public java.lang.String readToString(int length)

Parameters:

length - Reads up to len bytes of data from the input stream.

Returns:

(String,Int) two values, String for content, Int for the length of the bytes read.

Chapter 2 eXplo Lua Script System API Reference 121

Page 124: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

readFully

public byte[] readFully(int len)

Reads up to len bytes of data from the input stream.

Parameters:

len - The maximum number of bytes to read.

Returns:

A LuaTable will be returned which repsrenset the bytes read from the stream.

skipBytes

public int skipBytes(int len)

Reads up to len bytes of data from the input stream.

Parameters:

len - The maximum number of bytes to read.

Returns:

The length of bytes skiped.

readBoolean

public boolean readBoolean()

Reads one input byte and returns true if that byte is nonzero, false if that byte is zero.

Returns:

True if that byte is nonzero, otherwise, false.

readByte

public byte readByte()

Reads and returns one input byte.

Returns:

122 Class DataInputStream

Page 125: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

The byte value with an integer number returned.

readUnsignedByte

public int readUnsignedByte()

Reads one input byte, zero-extends it to type int, and returns the result which is therefore in the range 0 through 255.

Returns:

The unsigned value data with an integer number returned.

readShort

public short readShort()

Reads two input bytes and returns a short value.

Returns:

The short value with an integer number returned.

readUnsignedShort

public int readUnsignedShort()

Reads two input bytes, zero-extends it to type int, and returns an int value in the range 0 through 65535.

Returns:

The unsigned short value with an integer number returned.

readChar

public char readChar()

Reads an input char and returns the char value.

Returns:

The char value.

Chapter 2 eXplo Lua Script System API Reference 123

Page 126: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

readInt

public int readInt()

Reads four input bytes and returns an int value.

Returns:

The integer value.

readLong

public long readLong()

Reads eight input bytes and returns a long value.

Returns:

The long integer value.

readFloat

public float readFloat()

Reads four input bytes and returns a float value.

Returns:

The float value.

readDouble

public double readDouble()

Reads eight input bytes and returns a double value

Returns:

The double float point number value.

readUTF

public java.lang.String readUTF()

Reads in a string that has been encoded using a modified UTF-8 format.

124 Class DataInputStream

Page 127: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Returns:

The string.

Chapter 2 eXplo Lua Script System API Reference 125

Page 128: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.io

Class DataOutputStreamjava.lang.Object

com.explo.features.script.io.DataOutputStream

public class DataOutputStream

extends java.lang.Object

The DataOutput interface provides for converting data from any of the Java primitive types to a series of bytes and writing these bytes to a binary stream. There is also a facility for converting a String into Java modified UTF-8 format and writing the resulting series of bytes.

Constructor SummaryDataOutputStream()

Method Summary

voidclose() Closes this output stream and releases any system resources associated with this stream.

voidflush() Flushes this output stream and forces any buffered output bytes to be written out.

voidwrite(int value) Writes the specified byte to this output stream.

void

write(com.explo.features.script.vm.LuaTable table) Writes all index bytes from the specified table to this output stream.

void

write(com.explo.features.script.vm.LuaTable table, int offset, int len) Writes len bytes from the specified byte table starting at offset off to this output stream.

voidwrite(java.lang.String s) Writes bytes from the specified string with UTF-8 encode to this output stream.

voidwriteBoolean(boolean b) Writes a boolean value to this output stream.

voidwriteByte(int v) Writes to the output stream the eight low- order bits of the argument v.

126 Class DataOutputStream

Page 129: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

DataOutputStream

public DataOutputStream()

voidwriteChar(char c) Writes a char value, which is comprised of two bytes, to the output stream.

void

writeChars(com.explo.features.script.vm.LuaTable t) Writes every character in the string s, to the output stream, in order, two bytes per character.

voidwriteDouble(double v) Writes a double value, which is comprised of eight bytes, to the output stream.

voidwriteFloat(float v) Writes a float value, which is comprised of four bytes, to the output stream.

voidwriteInt(int v) Writes an int value, which is comprised of four bytes, to the output stream.

voidwriteLong(long v) Writes an long value, which is comprised of four bytes, to the output stream.

voidwriteShort(int v) Writes two bytes to the output stream to represent the value of the argument.

void

writeUTF(java.lang.String s) Writes two bytes of length information to the output stream, followed by the Java modified UTF representation of every character in the string s.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Method Detail

Method Summary

Chapter 2 eXplo Lua Script System API Reference 127

Page 130: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

write

public void write(int value)

Writes the specified byte to this output stream.

Parameters:

value - The integer value.

write

public void write(java.lang.String s)

Writes bytes from the specified string with UTF-8 encode to this output stream.

Parameters:

value - The string content.

write

public void write(com.explo.features.script.vm.LuaTable table)

Writes all index bytes from the specified table to this output stream.

Parameters:

value - The bytes table.

write

public void write(com.explo.features.script.vm.LuaTable table, int offset, int len)

Writes len bytes from the specified byte table starting at offset off to this output stream.

Parameters:

table -

offset -

len -

128 Class DataOutputStream

Page 131: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

flush

public void flush()

Flushes this output stream and forces any buffered output bytes to be written out.

close

public void close()

Closes this output stream and releases any system resources associated with this stream.

writeBoolean

public void writeBoolean(boolean b)

Writes a boolean value to this output stream.

writeByte

public void writeByte(int v)

Writes to the output stream the eight low- order bits of the argument v.

writeShort

public void writeShort(int v)

Writes two bytes to the output stream to represent the value of the argument.

writeChar

public void writeChar(char c)

Writes a char value, which is comprised of two bytes, to the output stream.

writeInt

public void writeInt(int v)

Writes an int value, which is comprised of four bytes, to the output stream.

Chapter 2 eXplo Lua Script System API Reference 129

Page 132: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

writeLong

public void writeLong(long v)

Writes an long value, which is comprised of four bytes, to the output stream.

writeFloat

public void writeFloat(float v)

Writes a float value, which is comprised of four bytes, to the output stream.

writeDouble

public void writeDouble(double v)

Writes a double value, which is comprised of eight bytes, to the output stream.

writeChars

public void writeChars(com.explo.features.script.vm.LuaTable t)

Writes every character in the string s, to the output stream, in order, two bytes per character.

writeUTF

public void writeUTF(java.lang.String s)

Writes two bytes of length information to the output stream, followed by the Java modified UTF representation of every character in the string s.

130 Class DataOutputStream

Page 133: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Package com.explo.features.script.lib A complete list of the com.explo.features.script.lib classes are shown below:

■ Class Font‚ on page 132

■ Class Graphics‚ on page 139

■ Class Image‚ on page 156

■ Class Sprite‚ on page 162

■ Class Timer‚ on page 173

Chapter 2 eXplo Lua Script System API Reference 131

Page 134: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.lib

Class Fontjava.lang.Object

com.explo.features.script.lib.Font

public class Font

extends java.lang.Object

The Font class represents fonts and font metrics. Fonts cannot be created by applications. Instead, applications query for fonts based on font attributes and the system will attempt to provide a font that matches the requested attributes as closely as possible.

Constructor SummaryFont()

Method Summary

int

charsWidth(char[] ac, int i, int j) Returns the advance width of the characters in ch, starting at the specified offset and for the specified number of characters (length).

intcharWidth(char c) Gets the advance width of the specified character in this Font.

intgetBaselinePosition() Gets the distance in pixels from the top of the text to the text's baseline.

Static FontgetDefaultFont() Gets the default font of the system

intgetFace() Gets the face of the font.

Static FontgetFont(int fontSpecifier) Gets the Font used by the high level user interface for the fontSpecifier passed in

Static FontgetFont(int face, int style, int size) Obtains an object representing a font having the specified face, style, and size

intgetHeight() Gets the standard height of a line of text in this font.

intgetSize() Gets the size of the font.

132 Class Font

Page 135: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Font

public Font()

getDefaultFont

public static Font getDefaultFont()

Gets the default font of the system

Returns:

A LuaTable will be returned which represents the default font provided by native.

intgetStyle() Gets the style of the font.

booleanisBold() Returns true if the font is bold.

booleanisItalic() Returns true if the font is italic.

booleanisPlain() Returns true if the font is plain.

booleanisUnderlined() Returns true if the font is underlined.

intstringWidth(java.lang.String s) Gets the total advance width for showing the specified String in this Font.

int

substringWidth(java.lang.String s, int i, int j) Returns the advance width of the characters in ch, starting at the specified offset and for the specified number of characters (length).

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Method Detail

Method Summary

Chapter 2 eXplo Lua Script System API Reference 133

Page 136: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getFont

public static Font getFont(int fontSpecifier)

Gets the Font used by the high level user interface for the fontSpecifier passed in

Parameters:

fontSpecifier - One of FONT_INPUT_TEXT, or FONT_STATIC_TEXT.

Returns:

A LuaTable will be returned which represents the font that corresponds to the passed in font specifier.

getFont

public static Font getFont(int face, int style, int size)

Obtains an object representing a font having the specified face, style, and size.

Parameters:

face - One of FACE_SYSTEM, FACE_MONOSPACE, or FACE_PROPORTIONAL.

style - STYLE_PLAIN, or a combination of STYLE_BOLD, STYLE_ITALIC, and STYLE_UNDERLINED.

size - One of SIZE_SMALL, SIZE_MEDIUM, or SIZE_LARGE.

Returns:

A LuaTable will be returned which represents an instance the nearest font found.

getStyle

public int getStyle()

Gets the style of the font. The value is an OR'ed combination of STYLE_BOLD, STYLE_ITALIC, and STYLE_UNDERLINED; or the value is zero (STYLE_PLAIN).

Returns:

The style of the current font.

134 Class Font

Page 137: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getSize

public int getSize()

Gets the size of the font.

Returns:

One of SIZE_SMALL, SIZE_MEDIUM, SIZE_LARGE.

getFace

public int getFace()

Gets the face of the font.

Returns:

One of FACE_SYSTEM, FACE_PROPORTIONAL, FACE_MONOSPACE.

isPlain

public boolean isPlain()

Returns true if the font is plain.

Returns:

True if the font is plain.

isBold

public boolean isBold()

Returns true if the font is bold.

Returns:

True if the font is bold.

isItalic

public boolean isItalic()

Returns true if the font is italic.

Chapter 2 eXplo Lua Script System API Reference 135

Page 138: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Returns:

True if the font is italic.

isUnderlined

public boolean isUnderlined()

Returns true if the font is underlined.

Returns:

True if the font is underlined.

getHeight

public int getHeight()

Gets the standard height of a line of text in this font. This value includes sufficient spacing to ensure that lines of text painted this distance from anchor point to anchor point are spaced as intended by the font designer and the device. This extra space (leading) occurs below the text.

Returns:

Standard height of a line of text in this font (a non-negative value).

getBaselinePosition

public int getBaselinePosition()

Gets the distance in pixels from the top of the text to the text's baseline.

Returns:

The distance in pixels from the top of the text to the text's baseline.

charWidth

public int charWidth(char c)

Gets the advance width of the specified character in this Font. The advance width is the horizontal distance that would be occupied if ch were to be drawn using this Font, including inter-character spacing following ch necessary for proper positioning of subsequent text.

136 Class Font

Page 139: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Parameters:

c - the character to be measured

Returns:

The total advance width (a non-negative value).

charsWidth

public int charsWidth(char[] ac, int i, int j)

Returns the advance width of the characters in ch, starting at the specified offset and for the specified number of characters (length). The advance width is the horizontal distance that would be occupied if the characters were to be drawn using this Font, including inter-character spacing following the characters necessary for proper positioning of subsequent text. The offset and length parameters must specify a valid range of characters within the character array ch. The offset parameter must be within the range [0..(ch.length)], inclusive. The length parameter must be a non-negative integer such that (offset + length) <= ch.length.

Parameters:

ac - The array of characters.

i - The index of the first character to measure.

j - The number of characters to measure.

Returns:

The width of the character range.

stringWidth

public int stringWidth(java.lang.String s)

Gets the total advance width for showing the specified String in this Font. The advance width is the horizontal distance that would be occupied if str were to be drawn using this Font, including inter-character spacing following str necessary for proper positioning of subsequent text.

Parameters:

s - the String to be measured.

Chapter 2 eXplo Lua Script System API Reference 137

Page 140: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Returns:

The total advance width.

substringWidth

public int substringWidth(java.lang.String s, int i, int j)

Returns the advance width of the characters in ch, starting at the specified offset and for the specified number of characters (length). The advance width is the horizontal distance that would be occupied if the characters were to be drawn using this Font, including inter-character spacing following the characters necessary for proper positioning of subsequent text. The offset and length parameters must specify a valid range of characters within the character array ch. The offset parameter must be within the range [0..(ch.length)], inclusive. The length parameter must be a non-negative integer such that (offset + length) <= ch.length.

Parameters:

s - The the String to be measured.

i - The zero-based index of first character in the substring.

j - The length of the substring.

Returns:

The total advance width.

138 Class Font

Page 141: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.lib

Class Graphicsjava.lang.Object

com.explo.features.script.lib.Graphics

public class Graphics

extends java.lang.Object.

Drawing primitives are provided for text, images, lines, rectangles, and arcs. Rectangles and arcs may also be filled with a solid color. Rectangles may also be specified with rounded corners.

Constructor SummaryGraphics()

Method Summary

voidclipRect(int x, int y, int width, int height) Intersects the current clip with the specified rectangle.

void

copyArea(int x_src, int y_src, int width, int height, int x_dest, int y_dest, int anchor) Copies the contents of a rectangular area (x_src, y_src, width, height) to a destination area, whose anchor point identified by anchor is located at (x_dest, y_dest).

void

drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) Draws the outline of a circular or elliptical arc covering the specified rectangle, using the current color and stroke style.

void

drawChar(char character, int x, int y, int anchor) Draws the specified character using the current font and color.

void

drawChars(char[] data, int offset, int length, int x, int y, int anchor) Draws the specified characters using the current font and color.

voiddrawImage(Image img, int x, int y, int anchor) Draws the specified image by using the anchor point.

Chapter 2 eXplo Lua Script System API Reference 139

Page 142: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

voiddrawLine(int i, int j, int k, int l) Draws a line between the coordinates (x1,y1) and (x2,y2) using the current color and stroke style.

void

drawRect(int x, int y, int width, int height) Draws the outline of the specified rectangle using the current color and stroke style.

void

drawRegion(Image src, int x_src, int y_src, int width, int height, int transform, int x_dest, int y_dest, int anchor) Copies a region of the specified source image to a location within the destination, possibly transforming (rotating and reflecting) the image data using the chosen transform function.

void

drawRGB(int[] rgbData, int offset, int scanlength, int x, int y, int width, int height, boolean processAlpha) Renders a series of device-independent RGB+transparency values in a specified region.

void

drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) Draws the outline of the specified rounded corner rectangle using the current color and stroke style.

void

drawString(java.lang.String s, int x, int y, int anchor) Draws the specified String using the current font and color.

void

fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) Fills a circular or elliptical arc covering the specified rectangle.

voidfillRect(int x, int y, int width, int height) Fills the specified rectangle with the current color.

void

fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) Fills the specified rounded corner rectangle with the current color.

voidfillTriangle(int x1, int y1, int x2, int y2, int x3, int y3) Fills the specified triangle will the current color.

voidgetBlueComponent() Gets the blue component of the current color.

voidgetClipHeight() Gets the height of the current clipping area.

Method Summary

140 Class Graphics

Page 143: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

voidgetClipWidth() Gets the width of the current clipping area.

voidgetClipX() Gets the X offset of the current clipping area, relative to the coordinate system origin of this graphics context.

voidgetClipY() Gets the Y offset of the current clipping area, relative to the coordinate system origin of this graphics context.

intgetColor() Gets the current color.

intgetDisplayColor(int color) Gets the color that will be displayed if the specified color is requested.

FontgetFont() Gets the current font.

int

getGrayScale() Gets the current grayscale value of the color being used for rendering operations.If the color was set by setGrayScale(), that value is simply returned.

intgetGreenComponent() Gets the green component of the current color.

intgetRedComponent() Gets the green component of the current color.

intgetStrokeStyle() Gets the stroke style used for drawing operations.

intgetTranslateX() Gets the X coordinate of the translated origin of this graphics context

intgetTranslateY() Gets the Y coordinate of the translated origin of this graphics context.

void

setClip(int x, int y, int width, int height) Sets the current clip to the rectangle specified by the given coordinates.

voidsetColor(int RGB) Sets the current color to the specified RGB values.

voidsetColor(int red, int green, int blue) Sets the current color to the specified RGB values.

voidsetFont(Font font) Sets the font for all subsequent text rendering operations.

Method Summary

Chapter 2 eXplo Lua Script System API Reference 141

Page 144: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Graphics

public Graphics()

translate

public void translate(int x, int y)

Translates the origin of the graphics context to the point (x, y) in the current coordinate system.

Parameters:

x - The x coordinate of the new translation origin.

y - The y coordinate of the new translation origin.

getTranslateX

public int getTranslateX()

Gets the X coordinate of the translated origin of this graphics context.

voidsetGrayScale(int value) Sets the current grayscale to be used for all subsequent rendering operations.

voidsetStrokeStyle(int style) Sets the stroke style used for drawing lines, arcs, rectangles, and rounded rectangles.

voidtranslate(int x, int y) Translates the origin of the graphics context to the point (x, y) in the current coordinate system.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Method Detail

Method Summary

142 Class Graphics

Page 145: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Returns:

X of current origin.

getTranslateY

public int getTranslateY()

Gets the Y coordinate of the translated origin of this graphics context.

Returns:

Y of current origin.

getColor

public int getColor()

Gets the current color.

Returns:

An integer in form 0x00RRGGBB.

getRedComponent

public int getRedComponent()

Gets the green component of the current color.

Returns:

Integer value in range 0-255.

getGreenComponent

public int getGreenComponent()

Gets the green component of the current color.

Returns:

Integer value in range 0-255.

Chapter 2 eXplo Lua Script System API Reference 143

Page 146: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getBlueComponent

public int getBlueComponent()

Gets the blue component of the current color.

Returns:

Integer value in range 0-255

getGrayScale

public int getGrayScale()

Gets the current grayscale value of the color being used for rendering operations.If the color was set by setGrayScale(), that value is simply returned. If the color was set by one of the methods that allows setting of the red, green, and blue components, the value returned is computed from the RGB color components (possibly in a device-specific fashion) that best approximates the brightness of that color.

Returns:

Integer value in range 0-255.

setColor

public void setColor(int red, int green, int blue)

Sets the current color to the specified RGB values. All subsequent rendering operations will use this specified color.

Parameters:

red - The red component of the color being set in range 0-255.

green - The green component of the color being set in range 0-255.

blue - The blue component of the color being set in range 0-255.

setColor

public void setColor(int RGB)

Sets the current color to the specified RGB values. All subsequent rendering operations will use this specified color.

144 Class Graphics

Page 147: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Parameters:

RGB - The color being set.

setGrayScale

public void setGrayScale(int value)

Sets the current grayscale to be used for all subsequent rendering operations. For monochrome displays, the behavior is clear. For color displays, this sets the color for all subsequent drawing operations to be a gray color equivalent to the value passed in. The value must be in the range 0-255.

Parameters:

value - The desired grayscale value.

getFont

public Font getFont()

Gets the current font.

Returns:

A LuaTable will be returned which represents the current font.

setStrokeStyle

public void setStrokeStyle(int style)

Sets the stroke style used for drawing lines, arcs, rectangles, and rounded rectangles. This does not affect fill, text, and image operations.

Parameters:

style - Can be SOLID or DOTTED (please reference to the Constants definition).

getStrokeStyle

public int getStrokeStyle()

Gets the stroke style used for drawing operations.

Returns:

Chapter 2 eXplo Lua Script System API Reference 145

Page 148: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Stroke style, SOLID or DOTTED (please reference to the Constants definition).

setFont

public void setFont(Font font)

Sets the font for all subsequent text rendering operations.

Parameters:

Font - A LuaTable will be returned which represents the specified font.

getClipX

public int getClipX()

Gets the X offset of the current clipping area, relative to the coordinate system origin of this graphics context.

Returns:

X offset of the current clipping area.

getClipY

public int getClipY()

Gets the Y offset of the current clipping area, relative to the coordinate system origin of this graphics context.

Returns:

Y offset of the current clipping area.

getClipWidth

public int getClipWidth()

Gets the width of the current clipping area.

Returns:

Width of the current clipping area.

146 Class Graphics

Page 149: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getClipHeight

public int getClipHeight()

Gets the height of the current clipping area.

Returns:

Height of the current clipping area.

clipRect

public void clipRect(int x, int y, int width, int height)

Intersects the current clip with the specified rectangle. The resulting clipping area is the intersection of the current clipping area and the specified rectangle. This method can only be used to make the current clip smaller. To set the current clip larger, use the setClip method. Rendering operations have no effect outside of the clipping area.

Parameters:

x - The x coordinate of the rectangle to intersect the clip with.

y - The y coordinate of the rectangle to intersect the clip with.

width - The width of the rectangle to intersect the clip with.

height - The height of the rectangle to intersect the clip with.

setClip

public void setClip(int x, int y, int width, int height)

Sets the current clip to the rectangle specified by the given coordinates. Rendering operations have no effect outside of the clipping area.

Parameters:

x - The x coordinate of the new clip rectangle.

y - The y coordinate of the new clip rectangle.

width - The width of the new clip rectangle.

height - The height of the new clip rectangle.

Chapter 2 eXplo Lua Script System API Reference 147

Page 150: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

drawLine

public void drawLine(int i, int j, int k, int l)

Draws a line between the coordinates (x1,y1) and (x2,y2) using the current color and stroke style.

Parameters:

i - the x coordinate of the start of the line.

j - the y coordinate of the start of the line.

k - the x coordinate of the end of the line.

l - the y coordinate of the end of the line.

fillRect

public void fillRect(int x, int y, int width, int height)

Fills the specified rectangle with the current color. If either width or height is zero or less, nothing is drawn.

Parameters:

x - The x coordinate of the rectangle to be filled.

y - The y coordinate of the rectangle to be filled.

width - The width of the rectangle to be filled.

height- The height of the rectangle to be filled.

drawRect

public void drawRect(int x, int y, int width, int height)

Draws the outline of the specified rectangle using the current color and stroke style. The resulting rectangle will cover an area (width + 1) pixels wide by (height + 1) pixels tall. If either width or height is less than zero, nothing is drawn.

Parameters:

x - The x coordinate of the rectangle to be drawn.

y - The y coordinate of the rectangle to be drawn.

148 Class Graphics

Page 151: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

width - The width of the rectangle to be drawn.

height - The height of the rectangle to be drawn.

drawRoundRect

public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)

Draws the outline of the specified rounded corner rectangle using the current color and stroke style. The resulting rectangle will cover an area (width + 1) pixels wide by (height + 1) pixels tall. If either width or height is less than zero, nothing is drawn.

Parameters:

x - The x coordinate of the rectangle to be drawn.

y - The y coordinate of the rectangle to be drawn.

width - The width of the rectangle to be drawn.

height - The height of the rectangle to be drawn.

arcWidth - The horizontal diameter of the arc at the four corners.

arcHeight - The vertical diameter of the arc at the four corners.

fillRoundRect

public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)

Fills the specified rounded corner rectangle with the current color. If either width or height is zero or less, nothing is drawn.

Parameters:

x - The x coordinate of the rectangle to be filled.

y - The y coordinate of the rectangle to be filled.

width - The width of the rectangle to be filled.

height - The height of the rectangle to be filled.

arcWidth - The horizontal diameter of the arc at the four corners.

Chapter 2 eXplo Lua Script System API Reference 149

Page 152: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

arcHeight - The vertical diameter of the arc at the four corners.

fillArc

public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)

Fills a circular or elliptical arc covering the specified rectangle.

Parameters:

x - The x coordinate of the upper-left corner of the arc to be filled.

y - The y coordinate of the upper-left corner of the arc to be filled.

width - The width of the arc to be filled.

height - The height of the arc to be filled.

startAngle - The beginning angle.

arcAngle - The angular extent of the arc, relative to the start angle.

drawArc

public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)

Draws the outline of a circular or elliptical arc covering the specified rectangle, using the current color and stroke style.

Parameters:

x - The x coordinate of the upper-left corner of the arc to be drawn.

y - The y coordinate of the upper-left corner of the arc to be drawn.

width - The width of the arc to be drawn.

height - The height of the arc to be drawn.

startAngle - The beginning angle.

arcAngle - The angular extent of the arc, relative to the start angle.

150 Class Graphics

Page 153: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

drawString

public void drawString(java.lang.String s, int x, int y, int anchor)

Draws the specified String using the current font and color. The x,y position is the position of the anchor point. See anchor points.

Parameters:

s - The String to be drawn.

x - The x coordinate of the anchor point.

y - The y coordinate of the anchor point.

anchor - The anchor point for positioning the text.

drawSubstring

public void drawSubstring(java.lang.String str, int offset, int len, int x, int y, int anchor)

Draws the specified String using the current font and color. The x,y position is the position of the anchor point. See anchor points

Parameters:

str - The String to be drawn.

offset - Zero-based index of first character in the substring.

len - Length of the substring.

x - The x coordinate of the anchor point.

y - The y coordinate of the anchor point.

anchor - The anchor point for positioning the text.

drawChar

public void drawChar(char character, int x, int y, int anchor)

Draws the specified character using the current font and color.

Parameters:

Chapter 2 eXplo Lua Script System API Reference 151

Page 154: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

character - The character to be drawn.

x - The x coordinate of the anchor point.

y - The y coordinate of the anchor point.

anchor - The anchor point for positioning the text; see anchor points.

drawChars

public void drawChars(char[] data, int offset, int length, int x, int y, int anchor)

Draws the specified characters using the current font and color.

Parameters:

data - the table of characters to be drawn

offset - the start offset in the data

length - the number of characters to be drawn

x - the x coordinate of the anchor point

y - the y coordinate of the anchor point

anchor - the anchor point for positioning the text; see anchor points

drawImage

public void drawImage(Image img, int x, int y, int anchor)

Draws the specified image by using the anchor point. The image can be drawn in different positions relative to the anchor point by passing the appropriate position constants.

Parameters:

img - The specified image to be drawn.

x - The x coordinate of the anchor point.

y - The y coordinate of the anchor point.

anchor - The anchor point for positioning the image.

152 Class Graphics

Page 155: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

drawRegion

public void drawRegion(Image src, int x_src, int y_src, int width, int height, int transform, int x_dest, int y_dest, int anchor)

Copies a region of the specified source image to a location within the destination, possibly transforming (rotating and reflecting) the image data using the chosen transform function.

Parameters:

src - The source image to copy from.

x_src - The x coordinate of the upper left corner of the region within the source image to copy.

y_src - The y coordinate of the upper left corner of the region within the source image to copy.

width - The width of the region to copy.

height - The height of the region to copy.

transform - The desired transformation for the selected region being copied.

x_dest - The x coordinate of the anchor point in the destination drawing area.

y_dest - The y coordinate of the anchor point in the destination drawing area.

anchor - The anchor point for positioning the region within the destination image.

copyArea

public void copyArea(int x_src, int y_src, int width, int height, int x_dest, int y_dest, int anchor)

Copies the contents of a rectangular area (x_src, y_src, width, height) to a destination area, whose anchor point identified by anchor is located at (x_dest, y_dest).

Parameters:

x_src - The x coordinate of upper left corner of source.

y_src -

width - The width of the source area.

Chapter 2 eXplo Lua Script System API Reference 153

Page 156: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

height - The height of the source area.

x_dest - The x coordinate of the destination anchor point.

y_dest - The y coordinate of the destination anchor point.

anchor - The anchor point for positioning the region within the destination image.

fillTriangle

public void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3)

Fills the specified triangle will the current color. The lines connecting each pair of points are included in the filled triangle.

Parameters:

x1 - The x coordinate of the first vertex of the triangle.

y1 - The y coordinate of the first vertex of the triangle.

x2 - The x coordinate of the second vertex of the triangle.

y2 - The y coordinate of the second vertex of the triangle.

x3 - The x coordinate of the third vertex of the triangle.

y3 - The y coordinate of the third vertex of the triangle.

drawRGB

public void drawRGB(int[] rgbData, int offset, int scanlength, int x, int y, int width, int height, boolean processAlpha)

Renders a series of device-independent RGB+transparency values in a specified region. The values are stored in rgbData in a format with 24 bits of RGB and an eight-bit alpha value (0xAARRGGBB), with the first value stored at the specified offset. The scanlength specifies the relative offset within the table between the corresponding pixels of consecutive rows. Any value for scanlength is acceptable (even negative values) provided that all resulting references are within the bounds of the rgbData table.

Parameters:

rgbData - A LuaTable of ARGB values in the format 0xAARRGGBB.

154 Class Graphics

Page 157: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

offset - The table index of the first ARGB value.

scanlength - The relative table offset between the corresponding pixels in consecutive rows in the rgbData table

x - The horizontal location of the region to be rendered.

y - The vertical location of the region to be rendered.

width - The width of the region to be rendered.

height - The height of the region to be rendered.

processAlpha - True if rgbData has an alpha channel, false if all pixels are fully opaque.

getDisplayColor

public int getDisplayColor(int color)

Gets the color that will be displayed if the specified color is requested. This method enables the developer to check the manner in which RGB values are mapped to the set of distinct colors that the device can actually display. For example, with a monochrome device, this method will return either 0xFFFFFF (white) or 0x000000 (black) depending on the brightness of the specified color.

Parameters:

color - The desired color (in 0x00RRGGBB format, the high-order byte is ignored.

Returns:

The corresponding color that will be displayed on the device's screen (in 0x00RRGGBB format)

Chapter 2 eXplo Lua Script System API Reference 155

Page 158: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.lib

Class Imagejava.lang.Object

com.explo.features.script.lib.Image

public class Image

extends java.lang.Object

The Image class is used to hold graphical image data. Image objects exist independently of the display device. They exist only in off-screen memory and will not be painted on the display unless an explicit command is issued by the application (such as within the paint() method of a Canvas) or when an Image object is placed within a Form screen or an Alert screen and that screen is made current. Images are either mutable or immutable depending upon how they are created. Immutable images are generally created by loading image data from resource bundles, from files, or from the network. They may not be modified once created. Mutable images are created as blank images containing only white pixels. The application may render on a mutable image by calling getGraphics() on the Image to obtain a Graphics object expressly for this purpose. Note: Images are represented by the LuaTable. when you use call some methods defined in Image Object is actually call the methods from LuaTable.

Constructor SummaryImage()

Method Summary

static Image

createImage(byte[] imageData, int imageOffset, int imageLength) Creates an immutable image which is decoded from the data stored in the specified byte array at the specified offset and length.

static Image createImage(Image source) Creates an immutable image from a source image.

static Image

createImage(Image image, int x, int y, int width, int height, int transform) Creates an immutable image using pixel data from the specified region of a source image, transformed as specified.

static ImagecreateImage(int width, int height) Creates a new, mutable image for off-screen drawing.

156 Class Image

Page 159: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Image

public Image()

createImage

public static Image createImage(int width, int height)

Creates a new, mutable image for off-screen drawing.

Parameters:

width - The width of the new image, in pixels.

static ImagecreateImage(java.lang.String name) Creates an immutable image from decoded image data obtained from the named resource

static Image

createRGBImage(int[] rgb, int width, int height, boolean processAlpha) Creates an immutable image from a sequence of ARGB values, specified as 0xAARRGGBB.

GraphicsgetGraphics() Creates a new Graphics object that renders to this image.

intgetHeight() Gets the height of the image in pixels.

ArraygetRGB(int x, int t, int width, int height) Obtains ARGB pixel data from the specified region of this image and stores it in the returned array of integers.

intgetWidth() Gets the width of the image in pixels.

booleanisMutable() Check if this image is mutable

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Method Detail

Method Summary

Chapter 2 eXplo Lua Script System API Reference 157

Page 160: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

height - The height of the new image, in pixels.

Returns:

A LuaTable will be returned which represents the created image.

createImage

public static Image createImage(Image source)

Creates an immutable image from a source image.

Parameters:

source - The source image to be copied.

Returns:

A LuaTable will be returned which represents the new, immutable image.

createImage

public static Image createImage(java.lang.String name) throws java.io.IOException

Creates an immutable image from decoded image data obtained from the named resource.

Parameters:

name - The name of the resource containing the image data in one of the supported image formats.

Returns:

The created image.

Throws:

java.io.IOException

createImage

public static Image createImage(byte[] imageData, int imageOffset, int imageLength)

158 Class Image

Page 161: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Creates an immutable image which is decoded from the data stored in specified byte array at the specified offset and length.

Parameters:

imageData - The array of image data in a supported image format.

imageOffset - The offset of the start of the data in the array.

imageLength - The length of the data in the array.

Returns:

A LuaTable will be returned which represents the created image.

createImage

public static Image createImage(Image image, int x, int y, int width, int height, int transform)

Creates an immutable image using pixel data from the specified region of a source image, transformed as specified.

Parameters:

image - The source image to be copied from.

x - Te horizontal location of the region to be copied.

y - The vertical location of the region to be copied.

width - The width of the region to be copied.

height - The height of the region to be copied.

transform - The transform to be applied to the region.

Returns:

A LuaTable that represents the new, immutable image.

getGraphics

public Graphics getGraphics()

Creates a new Graphics object that renders to this image. This image must be mutable.

Chapter 2 eXplo Lua Script System API Reference 159

Page 162: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Returns:

A LuaTable that represents the Graphics object with this image as its destination.

getWidth

public int getWidth()

Gets the width of the image in pixels.

Returns:

The width of the image.

getHeight

public int getHeight()

Gets the height of the image in pixels.

Returns:

The height of the image.

isMutable

public boolean isMutable()

Check if this image is mutable.

Returns:

True if the image is mutable, false otherwise.

createRGBImage

public static Image createRGBImage(int[] rgb, int width, int height, boolean processAlpha)

Creates an immutable image from a sequence of ARGB values, specified as 0xAARRGGBB. The ARGB data within the rgb array is arranged horizontally from left to right within each row, row by row from top to bottom. If processAlpha is true, the high-order byte specifies opacity; that is, 0x00RRGGBB specifies a fully transparent pixel and 0xFFRRGGBB specifies a fully opaque pixel.

Parameters:

160 Class Image

Page 163: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

rgb - An array of ARGB values that composes the image.

width - The width of the image.

height - The height of the image.

processAlpha - True if rgb has an alpha channel, false if all pixels are fully opaque.

Returns:

A LuaTable which represents the created image.

getRGB

public Array getRGB(int x, int t, int width, int height)

Obtains ARGB pixel data from the specified region of this image and stores it in the returned array of integers.

Parameters:

ai - An array of integers in which the ARGB pixel data is stored.

x - The x-coordinate of the upper left corner of the region.

y - The y-coordinate of the upper left corner of the region.

width - The width of the region.

height - The height of the region.

Returns:

A LuaTable that represents an Array Object will be returned.

Chapter 2 eXplo Lua Script System API Reference 161

Page 164: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.lib

Class Spritejava.lang.Object

com.explo.features.script.lib.Sprite

public class Sprite

extends java.lang.Object

A Sprite is a basic visual element that can be rendered with one of several frames stored in an Image; different frames can be shown to animate the Sprite. Several transforms such as flipping and rotation can also be applied to a Sprite to further vary its appearance. As with all Layer subclasses, a Sprite's location can be changed and it can also be made visible or invisible.

Constructor SummarySprite()

Method Summary

boolean

collidesWith(Image image, int x, int y, boolean pixelLevel) Checks for a collision between this Sprite and the specified TiledSprite.

boolean

collidesWith(Sprite s, boolean pixelLevel) Checks for a collision between this Sprite and the specified Sprite. If pixel-level detection is used, a collision is detected only if opaque pixels collide.

Spritecreate(Image image) Creates a new non-animated Sprite using the provided Image.

Sprite

create(Image image, int frameWidth, int frameHeight) Creates a new animated Sprite using frames contained in the provided Image.

Spritecreate(Sprite s) Creates a new Sprite from another Sprite.

voiddefineCollisionRectangle(int x, int y, int width, int height) Defines the Sprite's bounding rectangle that is used for collision detection purposes.

voiddefineReferencePixel(int x, int y) Defines the reference pixel for this Sprite.

intgetFrame() Gets the current index in the frame sequence.

162 Class Sprite

Page 165: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

intgetFrameSequenceLength() Gets the number of elements in the frame sequence.

intgetHeight() Gets the current height of this Sprite, in pixels.

intgetRawFrameCount() Gets the number of raw frames for this Sprite.

intgetRefPixelX() Gets the horizontal position of this Sprite's reference pixel in the painter's coordinate system.

intgetRefPixelY() Gets the vertical position of this Sprite's reference pixel in the painter's coordinate system.

intgetWidth() Gets the current width of this Sprite, in pixels.

intgetX() Gets the horizontal position of this Sprite's upper-left corner in the painter's coordinate system.

intgetY() Gets the vertical position of this Sprite's upper-left corner in the painter's coordinate system.

booleanisVisible() Gets the visibility of this Sprite.

voidmove(int dx, int dy) Moves this Sprite by the specified horizontal and vertical distances.

voidnextFrame() Selects the next frame in the frame sequence. The frame sequence is considered to be circular, i.e.

voidpaint(Graphics g) Draws current frame of Sprite using the provided Graphics object.

voidprevFrame() Selects the previous frame in the frame sequence. The frame sequence is considered to be circular, i.e.

voidsetFrame(int sequenceIndex) Selects the current frame in the frame sequence.

voidsetFrameSequence(int[] sequence) Set the frame sequence for this Sprite.

void

setImage(Image img, int frameWidth, int frameHeight) Replaces the current raw frames of the Sprite with a new set of raw frames.

Method Summary

Chapter 2 eXplo Lua Script System API Reference 163

Page 166: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Sprite

public Sprite()

create

public Sprite create(Image image)

Creates a new non-animated Sprite using the provided Image.

Parameters:

image - The Image to use as the single frame for the Sprite.

Returns:

A LuaTable that represents the new created sprite.

create

public Sprite create(Image image, int frameWidth, int frameHeight)

voidsetPosition(int x, int y) Sets this Sprite's position such that its upper-left corner is located at (x,y) in the painter's coordinate system.

voidsetRefPixelPosition(int x, int y) Sets this Sprite's position such that its reference pixel is located at (x,y) in the painter's coordinate system.

voidsetTransform(int transform) Sets the transform for this Sprite.

voidsetVisible(boolean visible) Sets the visibility of this Sprite.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Method Detail

Method Summary

164 Class Sprite

Page 167: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Creates a new animated Sprite using frames contained in the provided Image.

Parameters:

image - The Image to use for Sprite.

frameWidth - The width, in pixels, of the individual raw frames.

frameHeight - The height, in pixels, of the individual raw frames.

Returns:

A LuaTable that represents the new created sprite.

create

public Sprite create(Sprite s)

Creates a new Sprite from another Sprite.

Parameters:

s - The Sprite to create a copy of.

Returns:

A LuaTable that represents the new created sprite.

defineReferencePixel

public void defineReferencePixel(int x, int y)

Defines the reference pixel for this Sprite. The pixel is defined by its location relative to the upper-left corner of the Sprite's un-transformed frame, and it may lay outside of the frame's bounds.

Parameters:

x - The horizontal location of the reference pixel, relative to the left edge of the un-transformed frame

y - The vertical location of the reference pixel, relative to the top edge of the un-transformed frame.

Chapter 2 eXplo Lua Script System API Reference 165

Page 168: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

setRefPixelPosition

public void setRefPixelPosition(int x, int y)

Sets this Sprite's position such that its reference pixel is located at (x,y) in the painter's coordinate system.

Parameters:

x - The horizontal location at which to place the reference pixel.

y - The vertical location at which to place the reference pixel.

getRefPixelX

public int getRefPixelX()

Gets the horizontal position of this Sprite's reference pixel in the painter's coordinate system.

Returns:

The horizontal location of the reference pixel.

getRefPixelY

public int getRefPixelY()

Gets the vertical position of this Sprite's reference pixel in the painter's coordinate system.

Returns:

The vertical location of the reference pixel.

setFrame

public void setFrame(int sequenceIndex)

Selects the current frame in the frame sequence.

Parameters:

sequenceIndex - The index of of the desired entry in the frame sequence.

166 Class Sprite

Page 169: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

getFrame

public final int getFrame()

Gets the current index in the frame sequence.

Returns:

The current index in the frame sequence.

getRawFrameCount

public int getRawFrameCount()

Gets the number of raw frames for this Sprite. The value returned reflects the number of frames; it does not reflect the length of the Sprite's frame sequence.

Returns:

The number of raw frames for this Sprite.

getFrameSequenceLength

public int getFrameSequenceLength()

Gets the number of elements in the frame sequence. The value returned reflects the length of the Sprite's frame sequence; it does not reflect the number of raw frames.

Returns:

The number of elements in this Sprite's frame sequence.

nextFrame

public void nextFrame()

Selects the next frame in the frame sequence. The frame sequence is considered to be circular, i.e. if nextFrame() is called when at the end of the sequence, this method will advance to the first entry in the sequence.

prevFrame

public void prevFrame()

Chapter 2 eXplo Lua Script System API Reference 167

Page 170: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Selects the previous frame in the frame sequence. The frame sequence is considered to be circular, i.e. if prevFrame() is called when at the start of the sequence, this method will advance to the last entry in the sequence.

paint

public final void paint(Graphics g)

Draws current frame of Sprite using the provided Graphics object.

Parameters:

g - A LuaTable that represents the graphics object to draw Sprite on.

setFrameSequence

public void setFrameSequence(int[] sequence)

Set the frame sequence for this Sprite.

Parameters:

sequence - A table of integers, where each integer represents a frame index.

setImage

public void setImage(Image img, int frameWidth, int frameHeight)

Replaces the current raw frames of the Sprite with a new set of raw frames.

Parameters:

img - The Image to use for Sprite.

frameWidth - The width in pixels of the individual raw frames.

frameHeight - The height in pixels of the individual raw frames.

defineCollisionRectangle

public void defineCollisionRectangle(int x, int y, int width, int height)

Defines the Sprite's bounding rectangle that is used for collision detection purposes. This rectangle is specified relative to the un-transformed Sprite's upper-left corner and defines the area that is checked for collision detection.

168 Class Sprite

Page 171: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Parameters:

x - The horizontal location of the collision rectangle relative to the untransformed Sprite's left edge.

y - The vertical location of the collision rectangle relative to the untransformed Sprite's top edge.

width - The width of the collision rectangle.

height - The height of the collision rectangle.

setTransform

public void setTransform(int transform)

Sets the transform for this Sprite. Transforms can be applied to a Sprite to change its rendered appearance. Transforms are applied to the original Sprite image; they are not cumulative, nor can they be combined. By default, a Sprite's transform is TRANS_NONE.

Parameters:

transform - The desired transform for this Sprite.

collidesWith

public final boolean collidesWith(Sprite s, boolean pixelLevel)

Checks for a collision between this Sprite and the specified Sprite. If pixel-level detection is used, a collision is detected only if opaque pixels collide. That is, an opaque pixel in the first Sprite would have to collide with an opaque pixel in the second Sprite for a collision to be detected. Only those pixels within the Sprites' respective collision rectangles are checked.

Parameters:

s - The Sprite to test for collision with.

pixelLevel - True to test for collision on a pixel-by-pixel basis, false to test using simple bounds checking.

Returns:

True if the two Sprites have collided, otherwise false.

Chapter 2 eXplo Lua Script System API Reference 169

Page 172: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

collidesWith

public final boolean collidesWith(Image image, int x, int y, boolean pixelLevel)

Checks for a collision between this Sprite and the specified TiledSprite. If pixel- level detection is used, a collision is detected only if opaque pixels collide. That is, an opaque pixel in the Sprite would have to collide with an opaque pixel in TiledSprite for a collision to be detected. Only those pixels within the Sprite's collision rectangle are checked.

Parameters:

image - The Image to test for collision.

x - The horizontal location of the Image's upper left corner.

y - The vertical location of the Image's upper left corner.

pixelLevel - True to test for collision on a pixel-by-pixel basis, false to test using simple bounds checking.

Returns:

True if this Sprite has collided with the Image, otherwise false.

setPosition

public void setPosition(int x, int y)

Sets this Sprite's position such that its upper-left corner is located at (x,y) in the painter's coordinate system. A Sprite is located at (0,0) by default.

Parameters:

x - The horizontal position.

y - The vertical position.

move

public void move(int dx, int dy)

Moves this Sprite by the specified horizontal and vertical distances. The Sprite's coordinates are subject to wrapping if the passed parameters will cause them to exceed beyond max number or minimize number.

170 Class Sprite

Page 173: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Parameters:

dx - The distance to move along horizontal axis (positive to the right, negative to the left).

dy - The distance to move along vertical axis (positive down, negative up).

getX

public final int getX()

Gets the horizontal position of this Sprite's upper-left corner in the painter's coordinate system.

Returns:

The Sprite's horizontal position.

getY

public final int getY()

Gets the vertical position of this Sprite's upper-left corner in the painter's coordinate system.

Returns:

The Sprite's vertical position.

getWidth

public final int getWidth()

Gets the current width of this Sprite, in pixels.

Returns:

The width in pixels.

getHeight

public final int getHeight()

Gets the current height of this Sprite, in pixels.

Returns:

Chapter 2 eXplo Lua Script System API Reference 171

Page 174: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

The height in pixels.

setVisible

public void setVisible(boolean visible)

Sets the visibility of this Sprite. A visible Sprite is rendered when its paint(Graphics) method is called; an invisible Sprite is not rendered.

Parameters:

visible -

isVisible

public final boolean isVisible()

Gets the visibility of this Sprite.

Returns:

True if the Sprite is visible, false if it is invisible.

172 Class Sprite

Page 175: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.lib

Class Timerjava.lang.Object

com.explo.features.script.lib.Timer

public class Timer

extends java.lang.Object

A facility for threads to schedule tasks for future execution in a background thread. Tasks may be scheduled for one-time execution, or for repeated execution at regular intervals. Corresponding to each Timer object is a single background thread that is used to execute all of the timer's tasks sequentially.

Constructor SummaryTimer()

Method Summary

static void

cancel(com.explo.features.script.vm.Closure closure)Terminates this timer, discarding any currently scheduled tasks.

static voidschedule(com.explo.features.script.vm.Closure closure, long delay)Schedules the specified task for execution after the specified delay.

static void

schedule(com.explo.features.script.vm.Closure closure, long delay, long period)Schedules the specified closure for repeated fixed-delay execution, beginning after the specified delay.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Chapter 2 eXplo Lua Script System API Reference 173

Page 176: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Timer

public Timer()

schedule

public static void schedule (com.explo.features.script.vm. Closure closure, long delay)

Schedules the specified task for execution after the specified delay.

Parameters:

closure - Closure to be scheduled.

delay - Delay in milliseconds before task is to be executed.

schedule

public static void schedule(com.explo.features.script.vm.Closure closure, long delay, long period)

Schedules the specified closure for repeated fixed-delay execution, beginning after the specified delay. Subsequent executions take place at approximately regular intervals separated by the specified period.

Parameters:

closure - Closure to be scheduled.

delay - Delay in milliseconds before task is to be executed.

period - Time in milliseconds between successive task executions.

cancel

public static void cancel (com.explo.features.script.vm.Closure closure)

Constructor Detail

Method Detail

174 Class Timer

Page 177: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Terminates this timer, discarding any currently scheduled tasks.

Parameters:

closure - Closure to be canceled.

Chapter 2 eXplo Lua Script System API Reference 175

Page 178: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

Package com.explo.features.script.vm This package provides classes for fundamental to the LUA standard programming. A complete list of the com.explo.features.script.lib classes are shown below:

■ Class Closure‚ on page 177

■ Class LuaTable‚ on page 178

176 Package com.explo.features.script.vm

Page 179: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.vm

Class Closurepublic interface Closure

The Closure is a function that defined in LUA script file which can be a member of a LuaTable. For the more information about closure, please reference to the manual of LUA language.

Chapter 2 eXplo Lua Script System API Reference 177

Page 180: LUA Script Developer's Guide and API References eXplo LUA Script Developer's Guide and API Reference Document Release 1.0, June 15, 2009 Copyright Notices Copyright (c) 2009 Gemini

com.explo.features.script.vm

Class LuaTablepublic interface LuaTable

LuaTable is the only data structure that is supported by LUA language which may used to present the instance of an Object or an array of a data set, etc. It can also be a member of another LuaTable, as well. For more detailed info about LuaTable please reference the Lua language manual.

178 Class LuaTable