This forum is in archive mode. You will not be able to post new content.

Author Topic: [Lua] Char to ASCII code  (Read 1257 times)

0 Members and 1 Guest are viewing this topic.

Offline noize

  • /dev/null
  • *
  • Posts: 7
  • Cookies: 0
  • Cry baby byte
    • View Profile
    • noize's blog
[Lua] Char to ASCII code
« on: July 21, 2013, 11:36:18 PM »
Just a simple script that shows you the ASCII code for any keystroke (single keys or keycombos (e.g: SHIFT + F2)).


Code: [Select]

--[[----------------------------------------------------------------------
' filename: c2a.wlua
' author: noize
------------------------------------------------------------------------]]


require("iuplua")


prompt = iup.text {
expand = "YES",
value = "Press one or more keys",
tip = "Key combos are accepted as well",
}


output = iup.text {
value = "together",
expand = "YES",
}


function prompt:k_any(key)
prompt.value = ""
output.value = key
end


dlg = iup.dialog {
iup.vbox {
iup.frame {
iup.hbox {
prompt,
},
title = "ASCII char",
},
iup.frame {
iup.hbox {
output
},
title = "ASCII code",
},
margin = "5x5",
gap = "5",
},
title = "Char to ASCII",
size = "EIGHTH",
background = "255 255 255",
}


dlg:show()


iup.SetFocus(prompt)


iup.MainLoop()




A quick one.
To create is to live twice.

Offline Xires

  • Noob Eater
  • Administrator
  • Knight
  • *
  • Posts: 379
  • Cookies: 149
    • View Profile
    • Feed The Trolls - Xires
Re: [Lua] Char to ASCII code
« Reply #1 on: July 22, 2013, 09:14:38 AM »
Actually useful, ty.  Handy for WMs that use Lua scripting like ion.
-Xires

Offline noize

  • /dev/null
  • *
  • Posts: 7
  • Cookies: 0
  • Cry baby byte
    • View Profile
    • noize's blog
Re: [Lua] Char to ASCII code
« Reply #2 on: July 22, 2013, 10:13:01 PM »
Actually useful, ty.  Handy for WMs that use Lua scripting like ion.


I know about Ion but I've never used it. How would this be more useful in Ion than in any other window manager? Or maybe, you were just naming Ion as it has Lua preinstalled?
To create is to live twice.

Offline Xires

  • Noob Eater
  • Administrator
  • Knight
  • *
  • Posts: 379
  • Cookies: 149
    • View Profile
    • Feed The Trolls - Xires
Re: [Lua] Char to ASCII code
« Reply #3 on: July 23, 2013, 01:01:38 AM »
I was naming ion as it uses lua for configuration and can be extended via lua scripts.
-Xires

 



Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.