Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How would I manage to do this?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Obfuscated
Newbie cheater
Reputation: 0

Joined: 14 Jan 2016
Posts: 14

PostPosted: Sun Jan 17, 2016 7:43 pm    Post subject: How would I manage to do this? Reply with quote

I have a textbox, and want to display it onto a textlabel... but there are a few questions I have first

1. Is there a way so that I can make it so the value in the textbox are ONLY aloud to be integers?

2. I'm trying to make it so that if the number entered into the textbox is greater than 100 then make the textlabel say "over 100"... but we all know you cant add inequalities to text, because text can't be measured.


Thank you guys!
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Sun Jan 17, 2016 10:40 pm    Post subject: Reply with quote

tonumber(str, base OPTIONAL) is what you're looking for.

The easiest way I can think of only allowing integers in the textbox is to lex/parse the input string in the OnChange property of the Edit class object for the textbox and make modifications to it from that. For example, here's a quick and dirty way of doing it:
Code:
function CEEdit1Change(sender)
  sender.Text = math.floor(tonumber(sender.Text) or 0)
end

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites