Accessing Touches in lua

61 views
Skip to first unread message

Mike

unread,
Dec 31, 2013, 8:59:13 AM12/31/13
to urh...@googlegroups.com
I'm trying to access the Touches array (TouchState) in lua.
It seems that the lua API is currently missing this one.
Any hints?

Lasse Öörni

unread,
Dec 31, 2013, 10:53:49 AM12/31/13
to
There's some months since Aster (Lua script bindings maintainer) has committed anything to the LuaScript subsystem. It's possible that someone else needs to step up to complete the Lua bindings. The bindings were originally tested by porting all the C++ / AngelScript samples to Lua, but they don't exercise all of the engine functions, such as touch input.

You are of course very welcome to contribute.

EDIT: even though you can't access the touches as an array, you should be able to call GetNumTouches() and GetTouch() by index from the Input object.

Mike

unread,
Dec 31, 2013, 11:38:04 AM12/31/13
to urh...@googlegroups.com
Thanks Lasse,

For now it is beyond my skills, hope to contribute in a near future.

Mike

unread,
Dec 31, 2013, 1:45:54 PM12/31/13
to urh...@googlegroups.com
The GetTouch() by index did the job perfectly. I'll post an example soon.

Mike

unread,
Dec 31, 2013, 4:56:36 PM12/31/13
to urh...@googlegroups.com
Example #18 with touch inputs, based on NinjaSnowWar.
Tested on Android with LuaJIT enabled.
18_CharacterDemo_Touch_Inputs.lua

Mike

unread,
Jan 3, 2014, 3:41:29 AM1/3/14
to urh...@googlegroups.com

Added gyroscope/accelerometer support.
18_CharacterDemo_Touch_Gyro.lua
Reply all
Reply to author
Forward
0 new messages