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 

Using 2 .Lua's together

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



Joined: 20 Jan 2006
Posts: 13

PostPosted: Tue Feb 07, 2006 6:17 pm    Post subject: Using 2 .Lua's together Reply with quote

If i do a (dofile "game.lua") can i from that Game.Lua get etc "Base" from the lua i came from?
Between index.lua and game.lua

I really need help with this, either i am stuck. :P
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Tue Feb 07, 2006 7:10 pm    Post subject: Reply with quote

How hard would that be to find out ??

You might need a startup program that is never revisited to set initial
values of variables, load pics, etc so they don't happen again, but
after that I don't see why you can't jump from one file to another.

The only problem I have found is that the file is loaded from memory
stick each time, even if it has already been loaded to RAM.
This will cause things to slow down while moving from one file to another.

Traditionaly, new data is loaded between levels of a game.
Art.
Back to top
View user's profile Send private message
CaptainChickenpants



Joined: 01 Feb 2006
Posts: 5

PostPosted: Tue Feb 07, 2006 7:14 pm    Post subject: Reply with quote

Dofile isn't the only method for running other scripts.
http://www.lua.org/pil/8.html

CC
Back to top
View user's profile Send private message
haxx_blaster



Joined: 20 Jan 2006
Posts: 13

PostPosted: Wed Feb 08, 2006 12:16 am    Post subject: Reply with quote

Art wrote:
How hard would that be to find out ??

You might need a startup program that is never revisited to set initial
values of variables, load pics, etc so they don't happen again, but
after that I don't see why you can't jump from one file to another.

The only problem I have found is that the file is loaded from memory
stick each time, even if it has already been loaded to RAM.
This will cause things to slow down while moving from one file to another.

Traditionaly, new data is loaded between levels of a game.
Art.


I have tryed to change "BGSound" to "BGSound2" from Menu.lua when "BGSound" is loaded from Game.lua And i diden't work at all.
Back to top
View user's profile Send private message
haxx_blaster



Joined: 20 Jan 2006
Posts: 13

PostPosted: Wed Feb 08, 2006 4:23 am    Post subject: Reply with quote

I got it to work with another lua file, i will do it throught 3 lua files then.
Back to top
View user's profile Send private message
fattymc03



Joined: 11 Feb 2006
Posts: 18

PostPosted: Tue Feb 21, 2006 6:50 am    Post subject: Reply with quote

you want to use: require "filename.lua" at the top of your program

that kinda creates a package. you'll be able to access anything in filename.lua from whatever file you put that line in
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