Lua and Skype

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Lua and Skype

Post by Nixola »

A friend of mine has found a dice roller that asks Skype permissions to access the messages sent and received, parses them and if it finds something like //XdY[+Z] it throws that/those di(c)e and prints the results. Is there something like a Lua interpreter that works the same way or a compiled library loadable in Lua that allows the script to access Skype messages?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: Lua and Skype

Post by Inny »

You probably want to start here: https://developer.skype.com/
I'm sure that with Lua and something like Alien or FFI, you could hook into skype's API and do some interesting things.

As for dice rolling, that's easy. "2D6+1" would be parsed like so:

Code: Select all

function dice_check( s )
  local dice, sides, bonus = string.match(s, "(%d+)[dD](%d+)(.*)")
  assert(dice and sides)
  local sum = bonus and tonumber(bonus) or 0
  for i = 1, tonumber(dice) do
    sum = sum + math.random(1, tonumber(sides))
  end
  return sum
end
Good luck and I wish you a +2 on your Programming Skill.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Lua and Skype

Post by Nixola »

I already tried there, but I couldn't figure out how to use it so I gave up after a couple of hours, thanks anyway

I don't want to create a diceroller, I'd like to have a lua interpreter that works through Skype, but thanks for the code ^^
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests