|
| 12 Mar 2017 07:13 AM |
| example: local operation = "1+1" print(operation) ### ##### does not print 2. How do i remove quotes(via script?) siggy |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2017 07:14 AM |
oh why roblox fix your tags
siggy |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2017 07:14 AM |
oh why roblox fix your tags
siggy
siggy |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2017 07:14 AM |
ouch i duplicated my post ;-;
siggy |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2017 07:15 AM |
example: local operation = "1+1" print(operation) Output: 1 + 1 How do i remove quotes via script?
siggy |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2017 07:20 AM |
| local pos = string.find(operation,'"') local pos2 = string.find(operation,'"',pos+1) local finalstring = ############################### |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2017 07:20 AM |
local p = string.find(operation,'"') local p2 = string.find(operation,'"',pos+1)
local string = string.sub( operation , p , p2) |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2017 07:22 AM |
| '"' = a double quote surrounded by single quotes |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2017 07:24 AM |
ok ignore that other one do
local operation = '"1+1"' local p = string.find(operation,'"') local p2 = string.find(operation,'"',p+1)
local tring = string.sub( operation , p+1 , p2-1) print(tring) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 12 Mar 2017 08:57 AM |
| local operation = 1+1 --no "" unless you want a string. print(operation) --> 2 (no "" means it is a numerical operation, not a string like "hi") -< A L L T H E C U # # # # # # S A R E D Y I N G >- |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2017 08:58 AM |
lol "stomer" is a bad word. thanks roblox |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2017 08:59 AM |
local operation = 1+1 --not a string, is a numbervalue print(operation) --> 2 |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2017 09:09 AM |
I actually said "via script"
siggy |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2017 09:16 AM |
OMG... the whole time i realised its tonumber then i do more string.sub()
siggy |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 12 Mar 2017 09:21 AM |
| Well, "tonumber("1 + 1")" will return nil. It just converts the argument to a number. |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2017 09:22 AM |
ROBLOX, please add tosymbol.
siggy |
|
|
| Report Abuse |
|
|
| |
|
|
| 12 Mar 2017 09:24 AM |
Example of loadstring? I never use loadstring and i need to get used to it
siggy |
|
|
| Report Abuse |
|
|
| |
|
|
| 12 Mar 2017 12:10 PM |
local operation = "1+1" local b = 0 loadstring("b = " .. operation) print(b) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 12 Mar 2017 03:01 PM |
That wouldn't even work at all. Your funny if you think the function returned to loadstring can see b as an upvalue.
Also local b = loadstring("return " .. operation)()
is enough |
|
|
| Report Abuse |
|
|
galio13
|
  |
| Joined: 20 Jul 2011 |
| Total Posts: 842 |
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 12 Mar 2017 03:19 PM |
local output = 0
for n in operation:gmatch('%d+') output = output + tonumber(n) end
print(output)
|
|
|
| Report Abuse |
|
|