|
| 29 Mar 2012 10:43 AM |
--[[ BLOODYSCALL's SCRIPTEH CHALLENGE ]]-- -Create code that does the following in TWO LINES - - Assign variable 'a' to the integer 1 - - If variable 'a' is integer '1' then - Variable 'b' is - - String "one" otherwise variable 'b' is string "not one" - Print variable 'b' - --[[ TWO LINES ONLY (And don't shove two lines together) - -- Ex. a = 1 b = 2 ]]-- |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2012 10:43 AM |
| If you can, doing it in one line is also nice. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 29 Mar 2012 10:50 AM |
This barely makes any sense
a=1 b=(a==1 and "one" or "not one") |
|
|
| Report Abuse |
|
|
| |
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
| |
|
|
| 29 Mar 2012 10:58 AM |
| nou. It would be three lines when you print(b). |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 29 Mar 2012 11:00 AM |
| this challenge is tedious. |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2012 11:02 AM |
| Thinking it up was 1% This is fun, and 99% trololol |
|
|
| Report Abuse |
|
|
| |
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 29 Mar 2012 11:07 AM |
| Any script can be in one line.. duh? |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
| |
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 29 Mar 2012 11:09 AM |
| "That second line is technically just a huge function call. " so in that case I can use loadstring? |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
|
| 29 Mar 2012 11:13 AM |
I still count that as a line cause I am a noob like that :D And I never thought of loadstring x3 I am so dumb... I take for granted you can do it with loadstring, try it a different way. (You were close before, nate. Just you varaiable declaration) |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2012 11:15 AM |
| Thinking about posting what I had now. |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 29 Mar 2012 11:24 AM |
a=1 b=loadstring([[return (...==1 and "one" or "not one"),print(...==1 and "one" or "not one")]])(a) |
|
|
| Report Abuse |
|
|
|
| 29 Mar 2012 11:25 AM |
Yuh, I have:
a,b=1,(a==1) and "one" or "not one" print(b)
Multiple variable declaration ftw.
|
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 29 Mar 2012 11:26 AM |
| What oysi posted is what I shoul've posted. For some reason I was working at it through loadstring and kept changing things around. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 29 Mar 2012 11:26 AM |
| Bloody, that wouldn't work. It would print "not one" no matter what a is. |
|
|
| Report Abuse |
|
|
oxcool1
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15444 |
|
| |
|
|
| 29 Mar 2012 11:29 AM |
You pretty much had it the first time, but you didn't have a,b = blahh instead had it a= blahh b = blahh |
|
|
| Report Abuse |
|
|
oxcool1
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15444 |
|
| |
|