Maurize Posted June 11, 2012 Share Posted June 11, 2012 If i have a string ( for example: "+" ) how can i remove the "string" to get a normal symbol i can work with? Link to comment
Kenix Posted June 11, 2012 Share Posted June 11, 2012 If you want remove '+' from string. You can use string.gsub local s = '2 + 2' local s = s:gsub( '+', '' ) print( s ) -- 2 2 You mean this? Link to comment
Al3grab Posted June 11, 2012 Share Posted June 11, 2012 If you want remove '+' from string. You can use string.gsub local s = '2 + 2' local s = s:gsub( '+', '' ) print( s ) -- 2 2 You mean this? he want to make : from : '2 + 2' to : 2 + 2 something like un-string Link to comment
Kenix Posted June 11, 2012 Share Posted June 11, 2012 Okay. You can load this via function loadstring. loadstring( 'n = 2 + 2' )( ) print( n ) -- 4 You can't get operator '+' from string. Link to comment
Maurize Posted June 11, 2012 Author Share Posted June 11, 2012 found another way, simply define the two operators from number(: anyway thanks! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now