Skip to content

Commit 88ed9fc

Browse files
authored
iOS/Android: Add Haptic Support Back (coronalabs#784)
1 parent dda8e45 commit 88ed9fc

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

librtt/Rtt_LuaLibSystem.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,21 @@ getTimer( lua_State *L )
389389
static int
390390
vibrate( lua_State *L )
391391
{
392-
LuaContext::GetPlatform( L ).GetDevice().Vibrate();
393-
return 0;
392+
const char* hapticType = NULL;
393+
const char* hapticStyle = NULL;
394+
395+
if ( lua_type( L, 1 ) == LUA_TSTRING)
396+
{
397+
hapticType = lua_tostring(L, 1);
398+
}
399+
if(lua_type( L, 2 ) == LUA_TSTRING)
400+
{
401+
hapticStyle = lua_tostring(L, 2);
402+
}
403+
404+
LuaContext::GetPlatform( L ).GetDevice().Vibrate(hapticType, hapticStyle);
405+
406+
return 0;
394407
}
395408

396409
static int

0 commit comments

Comments
 (0)