| View previous topic :: View next topic |
| Author |
Message |
MagicianFB
Joined: 10 Oct 2005 Posts: 11
|
Posted: Mon Nov 07, 2005 9:32 am Post subject: String to Code |
|
|
Is there any way to convert a string to normal code?
for example
| Code: | | print(tocode("3+3")) |
would print 6 |
|
| Back to top |
|
 |
KawaGeo
Joined: 27 Aug 2005 Posts: 191 Location: Calif Mountains
|
Posted: Mon Nov 07, 2005 11:56 am Post subject: |
|
|
<Deleted> _________________ Geo Massar
Retired Engineer |
|
| Back to top |
|
 |
LuMo
Joined: 21 Aug 2005 Posts: 410 Location: Austria
|
Posted: Tue Nov 08, 2005 4:25 am Post subject: |
|
|
save to file and dofile() ?
any better ideas? _________________ "Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com |
|
| Back to top |
|
 |
MikeHaggar
Joined: 18 Jul 2005 Posts: 116
|
Posted: Tue Nov 08, 2005 4:57 am Post subject: |
|
|
| Why would one need that? |
|
| Back to top |
|
 |
Bob535
Joined: 04 Nov 2005 Posts: 56
|
Posted: Tue Nov 08, 2005 5:41 am Post subject: |
|
|
| You could use it to return code from a function, although there are ways around this of course. One use may be for if you are inputing code via a text editor to be run by the program. |
|
| Back to top |
|
 |
MikeHaggar
Joined: 18 Jul 2005 Posts: 116
|
Posted: Tue Nov 08, 2005 6:25 am Post subject: |
|
|
| heh... ok |
|
| Back to top |
|
 |
MagicianFB
Joined: 10 Oct 2005 Posts: 11
|
Posted: Tue Nov 08, 2005 8:01 am Post subject: Ok.. got it |
|
|
| print(assert(loadstring("3+3"))) -> 6 |
|
| Back to top |
|
 |
|