..:D&G:.. Posted August 17, 2015 Share Posted August 17, 2015 Hello guys, I am trying to make a currency exchange window. You select the currency from a combobox, which is like this: "Dollars - USD" and I use this to split the "Dollars" (name) from the "USD" (initial): local listFrom = guiComboBoxGetSelected(currencyListFrom) local textFrom = guiComboBoxGetItemText(currencyListFrom, listFrom) local splittedNameFrom = split ( tostring ( textFrom ), " - " ) local currencyNameFrom = tostring ( splittedNameFrom [ 1 ] ) local currencyInitialsFrom = tonumber ( splittedNameFrom [ 2 ] ) The problem is that if I try to output "currencyInitialsFrom" into outputChatBox it gets nil, any ideas why? Thanks. Link to comment
AfuSensi Posted August 17, 2015 Share Posted August 17, 2015 Are you sure textFrom is returning the proper text? I tested this in runcode: crun outputChatBox( split("Dollars - USD"," - ")[1] ) outputChatBox( split("Dollars - USD"," - ")[2] ) And it works properly, so i really think it's textForm (guiComboBoxGetItemText) causing the issue. 1 Link to comment
..:D&G:.. Posted August 17, 2015 Author Share Posted August 17, 2015 It looks like it outputs nil here: local currencyInitialsTo = tonumber ( splittedNameTo [ 2 ] ) But I don't know why Link to comment
Sasu Posted August 17, 2015 Share Posted August 17, 2015 Are you sure textFrom is returning the proper text?I tested this in runcode: crun outputChatBox( split("Dollars - USD"," - ")[1] ) outputChatBox( split("Dollars - USD"," - ")[2] ) And it works properly, so i really think it's textForm (guiComboBoxGetItemText) causing the issue. In the picture, you tried without spaces so try without spaces. Link to comment
..:D&G:.. Posted August 17, 2015 Author Share Posted August 17, 2015 Are you sure textFrom is returning the proper text?I tested this in runcode: crun outputChatBox( split("Dollars - USD"," - ")[1] ) outputChatBox( split("Dollars - USD"," - ")[2] ) And it works properly, so i really think it's textForm (guiComboBoxGetItemText) causing the issue. In the picture, you tried without spaces so try without spaces. What spaces? I see that he used the spaces between the text and - ... Link to comment
Moderators Citizen Posted August 17, 2015 Moderators Share Posted August 17, 2015 Try to output textFrom and see if it outputs the value you are waiting for ? Link to comment
..:D&G:.. Posted August 17, 2015 Author Share Posted August 17, 2015 Try to output textFrom and see if it outputs the value you are waiting for ? Fixed! It was because I made it to be a "tonumber" instead of "tostring" Link to comment
Moderators Citizen Posted August 17, 2015 Moderators Share Posted August 17, 2015 dayum ! no one saw it ! nice catch A copy paste of the 1st line would have save you minutes if it not hours Link to comment
..:D&G:.. Posted August 17, 2015 Author Share Posted August 17, 2015 dayum ! no one saw it ! nice catchA copy paste of the 1st line would have save you minutes if it not hours Ikr I've been smashing my head on this script since 10am 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