Toribash
Original Post
Text inputs for Toribash
Title says it all. This little script is probably something that should be part of an SDK for useful things.

Text box inputs, useful they are.

How to use:
dofile("textinput.lua")

x = new_textbox1(1,1,25,function (a) echo(string.reverse(a)) end)
That's a simple way to make one. Piece by piece:

dofile("textinput.lua")
Enables these commands by executing the script.

x
The controller of the textbox.

(1,1
The position of the textbox.

,25
The maximum amount of characters it can hold.

,function (a) echo(string.reverse(a)) end)
The function called when enter is hit, where a is the inputted string.


Oh! And some developer! Please make it so that returning non-zero to stop a key from being processed works!
Attached Files
textinput.lua (2.0 KB, 31 views)
Last edited by suomynona; Sep 23, 2007 at 09:00 PM.
Oh no! Own goal!?
Try retuning non-zero also in key_up, will fix your problem.
 ____  _____  __  __  _  _  ___  _  _ 
(  _ \(  _  )(  )(  )( \( )/ __)( \/ )
 ) _ < )(_)(  )(__)(  )  (( (__  \  / 
(____/(_____)(______)(_)\_)\___) (__)