forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

String to Code

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
MagicianFB



Joined: 10 Oct 2005
Posts: 11

PostPosted: Mon Nov 07, 2005 9:32 am    Post subject: String to Code Reply with quote

Is there any way to convert a string to normal code?

for example
Code:
print(tocode("3+3"))

would print 6
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Mon Nov 07, 2005 11:56 am    Post subject: Reply with quote

<Deleted>
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Tue Nov 08, 2005 4:25 am    Post subject: Reply with quote

save to file and dofile() ?
any better ideas?
_________________
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Back to top
View user's profile Send private message Visit poster's website
MikeHaggar



Joined: 18 Jul 2005
Posts: 116

PostPosted: Tue Nov 08, 2005 4:57 am    Post subject: Reply with quote

Why would one need that?
Back to top
View user's profile Send private message
Bob535



Joined: 04 Nov 2005
Posts: 56

PostPosted: Tue Nov 08, 2005 5:41 am    Post subject: Reply with quote

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
View user's profile Send private message
MikeHaggar



Joined: 18 Jul 2005
Posts: 116

PostPosted: Tue Nov 08, 2005 6:25 am    Post subject: Reply with quote

heh... ok
Back to top
View user's profile Send private message
MagicianFB



Joined: 10 Oct 2005
Posts: 11

PostPosted: Tue Nov 08, 2005 8:01 am    Post subject: Ok.. got it Reply with quote

print(assert(loadstring("3+3"))) -> 6
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group