QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

equivalent of python's exec() in lua?

This is a discussion on equivalent of python's exec() in lua? within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Hey all, Just wondering, what is the equivalent of python's exec() function in lua? Here's an example of the syntax- ...

Reply
 
LinkBack Thread Tools
Old 02-17-2008, 03:18 PM   #1
 
spykr's Avatar
 
Join Date: Feb 2008
Posts: 8
Trader Feedback: 0
Default equivalent of python's exec() in lua?

Hey all,
Just wondering, what is the equivalent of python's exec() function in lua?
Here's an example of the syntax-
Code:
a="pri"
b="nt 12345"
exec(a+b)
and the output-
Code:
12345
I've googled this, but to no avail...

anyway, thanks for any help.
spykr
spykr is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-17-2008, 03:45 PM   #2

Developer
 
yaustar's Avatar
 
Join Date: Jun 2006
Location: UK
Posts: 2,317
Trader Feedback: 0
Default

Not 100% sure is one exists but what you can do as a work around is write the string to a file and use Lua's dofile( "filename" ) to execute it.
yaustar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-17-2008, 04:05 PM   #3

Muppet Magnet
 
Fanjita's Avatar
 
Join Date: Sep 2005
Location: Edinburgh, UK
Posts: 2,388
Trader Feedback: 0
Default

A little googling on "lua dofile" turns up this page, which does a decent job of explaining 'loadstring', which may well be what you're looking for.
Fanjita is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-17-2008, 05:56 PM   #4
No longer a community member.
 
a_noob's Avatar
 
Join Date: Sep 2006
Location: Over there.
Posts: 666
Trader Feedback: 0
Default

Code:
a = "prin"
b = "t(1234)"
loadstring(a..b)
a_noob is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
equivalent , exec , lua , python

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 11:44 AM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us