PDA

View Full Version : how i change from string "123" to number 123


lnd
12-30-2005, 11:09 AM
how i change from string "123" to number 123

Worm
12-30-2005, 11:21 AM
how i change from string "123" to number 123

nNumber = String.ToNumber("123")

lnd
12-30-2005, 11:46 AM
i am sory i deed to convert a number to string

Worm
12-30-2005, 12:00 PM
No need to convert it, but if you feel you need to, do something like this

nNum = 123;
sNum = nNum .. "";

lnd
12-30-2005, 12:15 PM
the code


tbFiles = FTP.ListFiles();

-- add each item to the listbox in this format:
-- <name> (<size>) (<date>)
for i = 1, tbFiles.Count do
local name = tbFiles[i].Name;
local size = tbFiles[i].Size;
local date = tbFiles[i].Date;

ListBox.AddItem("ListBox1", name, "");
end

Label.SetText("Label6", tbFiles);

error in - must be a string - Label.SetText("Label6", tbFiles);

Worm
12-30-2005, 12:22 PM
tbFiles is a table. You need to specify which element in the table you want.

Label.SetText("Label6", tbFiles[1].Name);

lnd
12-30-2005, 03:58 PM
and if i need the i and the i is a number the code

nNum = 123;
sNum = nNum .. "";

dont work on my code?

Intrigued
12-30-2005, 07:45 PM
There are a couple other ways, one I have used is:

"'"..strMyStringHere.."'"

Note the single quote between the double-quotes.