Seite 266 von 342 ErsteErste ... 166 216 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 316 ... LetzteLetzte
Zeige Ergebnis 7.951 bis 7.980 von 10238

Lua Programming Help Thread

This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; im almost finished my little app and i fixed my problems no thanks to you guys :Argh: haha no hard ...

  
  1. #7951
    QJ Gamer Bronze
    Points: 8.045, Level: 60
    Level completed: 48%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Ort
    Australia
    Beiträge
    659
    Points
    8.045
    Level
    60
    Downloads
    0
    Uploads
    0

    Standard

    im almost finished my little app and i fixed my problems no thanks to you guys :Argh: haha no hard feelings, i know i do seem like a noob but i do have a pretty good understanding of lua. just one question. when i overwrite a file in the flash it cuts the file from the memory stick instead of copying it. anyway to make it copy instead? thanks



  2. #7952
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    System.writeFile("path:/to/file","path:/to/destination", delete source file? "yes" or "no")

  3. #7953
    QJ Gamer Bronze
    Points: 8.045, Level: 60
    Level completed: 48%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Ort
    Australia
    Beiträge
    659
    Points
    8.045
    Level
    60
    Downloads
    0
    Uploads
    0

    Standard

    haha it was write underneath my nose, i thought that meant overwrite if a file of the asme name is present. thanks myshoo

  4. #7954
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von EminentJonFrost
    :ROFL:
    lua is the easiest thing to learn when coding for psp
    Depends. Some people can understand C/C++ better then Lua.

  5. #7955
    QJ Gamer Blue
    Points: 7.014, Level: 55
    Level completed: 32%, Points required for next Level: 136
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    U.S.
    Beiträge
    405
    Points
    7.014
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Compiling my lua script will help improve speed, correct? If so, what should I use to compile it? I've tried the XtreamLua Compiler with no luck.

    EDIT: Nevermind, I got the XtreamLua Compiler to work.
    Geändert von andyauff (08-26-2007 um 05:19 PM Uhr)

  6. #7956
    Developer
    Points: 4.318, Level: 41
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    205
    Points
    4.318
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Xsjado7
    hey everyone,
    @LMelior: it didnt work but thanks for trying.
    I did not "try" to fix it for you, because that's not a good way to help people. I was pointing out what was wrong. You moved your character (Exhibit A), then you set the "old" x and y positions to the current x and y positions (Exhibit B), and then checked for collision (Exhibit C). When the objects collide, you move the current x and y back to the old x and y, which - guess what - is exactly the same, thanks to your second step. So, like I said the first time, think about the order in which you do things.

    Zitat Zitat von andyauff
    Compiling my lua script will help improve speed, correct? If so, what should I use to compile it? I've tried the XtreamLua Compiler with no luck.

    EDIT: Nevermind, I got the XtreamLua Compiler to work.
    No, it doesn't improve execution speed. I think if you compile a file that you want to include with dofile or loadfile, then it speeds up the loading process, but if I recall correctly, that's the only speed benefit. Your best bet right now is to optimize your code. Once Luaplayer 0.21 is released though, the execution speed will be considerably better.

  7. #7957
    QJ Gamer Blue
    Points: 7.014, Level: 55
    Level completed: 32%, Points required for next Level: 136
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    U.S.
    Beiträge
    405
    Points
    7.014
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von LMelior
    No, it doesn't improve execution speed. I think if you compile a file that you want to include with dofile or loadfile, then it speeds up the loading process, but if I recall correctly, that's the only speed benefit. Your best bet right now is to optimize your code. Once Luaplayer 0.21 is released though, the execution speed will be considerably better.
    I see. Thanks.

  8. #7958
    Developer
    Points: 5.157, Level: 46
    Level completed: 4%, Points required for next Level: 193
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Beiträge
    726
    Points
    5.157
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard Wlan

    Hi guys, did anyone have any joy trying to use WLAN on Lua Player 0.20?

    I've been trying to access a file on my server to get some specific data for a HB I'm developing at the moment, but it just hangs. I've found lots of workaround, but none of them seem to work.

    I even thought I was doing something wrong, so I tried to run the WLAN code from the sample, which looks pretty much like what I developed, but it just hangs too.

    Did anyone get this sample to work?

    Cheers,

    Marcos Placona

  9. #7959
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von placo23
    Hi guys, did anyone have any joy trying to use WLAN on Lua Player 0.20?

    I've been trying to access a file on my server to get some specific data for a HB I'm developing at the moment, but it just hangs. I've found lots of workaround, but none of them seem to work.

    I even thought I was doing something wrong, so I tried to run the WLAN code from the sample, which looks pretty much like what I developed, but it just hangs too.

    Did anyone get this sample to work?

    Cheers,

    Marcos Placona
    Are you overclocking your psp? you have to keep the processor at default settings if you want to use wlan.

  10. #7960
    Developer
    Points: 5.157, Level: 46
    Level completed: 4%, Points required for next Level: 193
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Beiträge
    726
    Points
    5.157
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    I've changed everything, but it still doesn't work. I've changed my clock to default, changed Wlan.useConnectionConfig( 1) to Wlan.useConnectionConfig( 2), changed the hard reset to enabled and nothing.

    Does WLAN hava any problem with WPA?

    cheers

  11. #7961
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    i think it only has basic encryption in lua so i think it might have problems with that
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  12. #7962
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    I believe it doesn't work with WPA. Because I was able to use WLAN on lua player .20.

  13. #7963
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard Configuration file (config.txt) and coroutines

    Hi,

    I wanted to know if you were able to use a configuration file in LUA (i know in C it works) and how I could make one. Also I need some help with coroutines, what they are and do.

    -sony_psp_player

  14. #7964
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von sony psp player
    Hi,

    I wanted to know if you were able to use a configuration file in LUA (i know in C it works) and how I could make one. Also I need some help with coroutines, what they are and do.

    -sony_psp_player
    you mean a text file meant for the user to change settings on the comp? yea you can do that.

  15. #7965
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von EminentJonFrost
    you mean a text file meant for the user to change settings on the comp? yea you can do that.
    Change on computer and from PSP so it can save the current state of the app.

  16. #7966
    Developer
    Points: 5.157, Level: 46
    Level completed: 4%, Points required for next Level: 193
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Beiträge
    726
    Points
    5.157
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Yes, you can use config files normally. I use'em all the time.

    Just incluide your config file to you script.

    cheers

  17. #7967
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    I've looked on google now (may should have done before) and i found this: for line in file:lines.
    They said this function will iterate all over the file but it doesn't. It returnes every second line.

  18. #7968
    Developer
    Points: 5.157, Level: 46
    Level completed: 4%, Points required for next Level: 193
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Beiträge
    726
    Points
    5.157
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von sony psp player
    I've looked on google now (may should have done before) and i found this: for line in file:lines.
    They said this function will iterate all over the file but it doesn't. It returnes every second line.
    Ok, what are you trying to do? You don't need to read the file. If you want a config file, you can just set your variables into that file, and read the variables normally, as if it was an include. Know, if you wanna read specific bits of this file, you'll need to read it and iterate over the lines.

    I don't have code samples here, but I can send'em to you later today.

    Cheers

  19. #7969
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von placo23
    Ok, what are you trying to do? You don't need to read the file. If you want a config file, you can just set your variables into that file, and read the variables normally, as if it was an include. Know, if you wanna read specific bits of this file, you'll need to read it and iterate over the lines.

    I don't have code samples here, but I can send'em to you later today.

    Cheers
    No, I need to set the variables, too.

  20. #7970
    Developer
    Points: 5.157, Level: 46
    Level completed: 4%, Points required for next Level: 193
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Beiträge
    726
    Points
    5.157
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von sony psp player
    No, I need to set the variables, too.
    So it's easy. Just set whatever you need to set, and read'em

    I think it's pretty straight forward. Unless I'm not getting your point here.

    Do you wanna send me some piece of code telling exactly what you wanna do?

    Cheers

  21. #7971
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von placo23
    So it's easy. Just set whatever you need to set, and read'em

    I think it's pretty straight forward. Unless I'm not getting your point here.

    Do you wanna send me some piece of code telling exactly what you wanna do?

    Cheers
    Here is a detailed description of my problems:

    I want to save some information about the user, the position... in a file called "config.txt" so here are my problems:

    1. for line in file:lines doesn't iterate all over the file, it reads only every second line.
    2. i don't know how to add a new line to the file

  22. #7972
    Developer
    Points: 5.157, Level: 46
    Level completed: 4%, Points required for next Level: 193
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Beiträge
    726
    Points
    5.157
    Level
    46
    Downloads
    0
    Uploads
    0

    Thumbs up

    Here's an example:

    Code:
    file = io.open("myFile.txt", "r")
    	if file then
    		for line in file:lines() do
    			value = string.find(line, "userStatus=")
    			
    			if value then
    				return value
    			end
    		end
    	else
    		screen:print(100,100,"Error opening file!",color)
    	end
    That should open the file and iterate over all the lines.

    As per the append new line thingy, you can use

    Code:
    io.open (filename, "a")
    Which will open the file in append mode.

    Check the Lua Manual for more information

    Hope it helps you.

    Cheers

  23. #7973
    Developer
    Points: 5.157, Level: 46
    Level completed: 4%, Points required for next Level: 193
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Beiträge
    726
    Points
    5.157
    Level
    46
    Downloads
    0
    Uploads
    0

    Thumbs up

    Here's an example:

    Code:
    file = io.open("myFile.txt", "r")
    	if file then
    		for line in file:lines() do
    			value = string.find(line, "userStatus=")
    			
    			if value then
    				return value
    			end
    		end
    	else
    		screen:print(100,100,"Error opening file!",color)
    	end
    That should open the file and iterate over all the lines.

    As per the append new line thingy, you can use

    Code:
    io.open (filename, "a")
    Which will open the file in append mode.

    Check the Lua Manual for more information

    Hope it helps you.

    Cheers

  24. #7974
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    or you can use dofile

  25. #7975
    Developer
    Points: 5.157, Level: 46
    Level completed: 4%, Points required for next Level: 193
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Beiträge
    726
    Points
    5.157
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von myschoo
    or you can use dofile
    That will do too, but it ain't let him append to the file.

    Cheers

  26. #7976
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von placo23
    Here's an example:

    Code:
    file = io.open("myFile.txt", "r")
    	if file then
    		for line in file:lines() do
    			value = string.find(line, "userStatus=")
    			
    			if value then
    				return value
    			end
    		end
    	else
    		screen:print(100,100,"Error opening file!",color)
    	end
    That should open the file and iterate over all the lines.

    As per the append new line thingy, you can use

    Code:
    io.open (filename, "a")
    Which will open the file in append mode.

    Check the Lua Manual for more information

    Hope it helps you.

    Cheers
    Thanks for the example! The for line in file:lines returns only every second line still, but i can leave the lines that are not returned out. Thanks!

  27. #7977
    Developer
    Points: 5.157, Level: 46
    Level completed: 4%, Points required for next Level: 193
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Beiträge
    726
    Points
    5.157
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von sony psp player
    Thanks for the example! The for line in file:lines returns only every second line still, but i can leave the lines that are not returned out. Thanks!
    That's weird, 'cause I just tested here, and it returns me the whole file.

    Well glad that you found out a way around to that.

    Cheers

  28. #7978
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    How would i go about pausing my main loop when start is pressed ?

  29. #7979
    QJ Gamer Blue
    Points: 3.795, Level: 38
    Level completed: 97%, Points required for next Level: 5
    Overall activity: 27,0%

    Registriert seit
    Jul 2007
    Beiträge
    296
    Points
    3.795
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von placo23
    Here's an example:

    Code:
    file = io.open("myFile.txt", "r")
        if file then
            for line in file:lines() do
                value = string.find(line, "userStatus=")
                
                if value then
                    return value
                end
            end
        else
            screen:print(100,100,"Error opening file!",color)
        end
    That should open the file and iterate over all the lines.

    As per the append new line thingy, you can use

    Code:
    io.open (filename, "a")
    Which will open the file in append mode.

    Check the Lua Manual for more information

    Hope it helps you.

    Cheers
    Generally, you should check for error, rather than success. It makes for neater, and easier to read code.

  30. #7980
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von eldiablov
    How would i go about pausing my main loop when start is pressed ?
    Code:
    if pad:start() then
    	oldpad = pad
    	while true do
    		pad = Controls.read()
    		if pad:start() and not oldpad:start() then
    			break
    		end
    		oldpad = pad
    	end
    end


 

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 09:00 PM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .