|
| 18 Sep 2014 11:18 AM |
How would I make it into a string?
Table = {'32fsczc','f34tg'} for _,v in pairs(Table) do print(v)--Needs to be a string end |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 18 Sep 2014 11:21 AM |
| Should be fine... I don't see anything wrong with it, personally :/ |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 11:22 AM |
| No.. I need v to be a string.. >_< |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 18 Sep 2014 11:23 AM |
What is it if not a string? What does print(type(v)) output, since those example values are both strings. |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 11:27 AM |
Well I have this script i'm working on it has a thing like:
Table = {'32fsczc','f34tg'} for _,v in pairs(Table) do print(_G.MyFunction(v))--Needs to be a string end |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 11:29 AM |
Ik easy way to fix this. But I don't want the easy way out and no need for two tables. |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 11:31 AM |
The problem is within the table cause how it is: Table = {'123','321'}--Won't give it in a string. Table = {123,321}--Will give in string.
(The main table it uses is used by 2-3 other scripts in the game already so if I change it it will break them) |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 11:34 AM |
| Lul Nvm Ik how to fix i'll just unpack table and remake it derp. |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 11:44 AM |
| Wow, now it's telling me it's nil. T_T |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 18 Sep 2014 11:45 AM |
Something about this just sounds so inherently wrong. '32fsczc' is a string, and so is 'f34tg' '123','123' is a pair of strings 123, 123 is a pair of numbers, not strings... |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 11:46 AM |
Ok i'm confuzed how do I make it a string cause i Unpacked it and re-made it into a table...
|
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 18 Sep 2014 11:47 AM |
| '...' denotes a string. What I think you're trying to do, is have '32fsczc' as the key and 'f34tg' as the value? (For whatever reason) |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 11:48 AM |
| Well it works when I put any number in it but if I use anything from a table it says it's not a string. Sooo i'm lost. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 18 Sep 2014 11:49 AM |
Do me a favour and message me about it? I'll see if I can help work out what's wrong...
|
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 11:50 AM |
No cause in the script i'm using it's printing the number perfectly with print(v) but if I go and put v in the function it errors and says it isn't a string.
Oh I might know a quick fix for this.(may or may not work) |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 18 Sep 2014 11:51 AM |
| Ugh. You never did tell me what print(type(v)) gave... |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 11:52 AM |
| Idk still telling me there is an error. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
| |
|
|
| 18 Sep 2014 11:55 AM |
Wow......... It says string.. -_- and the error is string expected wth!!?!? |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 18 Sep 2014 11:56 AM |
Well evidently nothing was wrong, as I'd anticipated. Your code here: Table = {'32fsczc','f34tg'} for _,v in pairs(Table) do print(v)--Needs to be a string end
Gives no error in the pure Lua interpreter either. |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 12:03 PM |
That isn't the full code i'm using, this is:
Table = _G.List_Info() for _,v in pairs(Table) do print(_G.Name_Function(v))--Errors here end |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 12:05 PM |
But it works fine with: print(_G.Name_Function(1)) but not: print(_G.Name_Function(v)) donno why |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 18 Sep 2014 12:06 PM |
Then your error is in the other code. Now why on earth did you not tell me this stuff in the first place? If you message me, we can take a look at your code and I can actually see where you derped. At the moment, there's not nearly enough information to discern why and where you derped. |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2014 12:07 PM |
| Changed a few things now it's saying: concatenate a nil value |
|
|
| Report Abuse |
|
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
|
| 18 Sep 2014 12:10 PM |
function CheckString(word) local nums={1,2,3,4,5,6,7,8,9,0} for i,v in pairs(nums) do if string.find(word,v)~=nil then return false end end return true end
Table={"LOLLLL",1,2) for i,v in pairs(Table) do print(CheckString(v)) end |
|
|
| Report Abuse |
|
|