Advertising (This ad goes away for registered users. You can Login or Register)

Lua Player Plus: Debugging Lua Scripts Quickly

Open discussions on programming specifically for the PS Vita.
Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
Post Reply
beelzebielsk
Posts: 3
Joined: Wed Jan 03, 2018 6:20 pm

Lua Player Plus: Debugging Lua Scripts Quickly

Post by beelzebielsk » Wed Jan 03, 2018 6:59 pm

I've just found LPP and I'm trying to make a few games with it.
However, debugging is prohibitively slow, as I'm making a lot of
mistakes.
  • There's no stack trace when I hit an error. I know where the error
    actually happened, but I have no idea how I got to the error.
  • Each time I have to change something, it seems that I have to
    rebuild the whole vpk and re-install it.
So, the questions I have are:
  • Is there already some way to test these lua scripts on my computer
    before sending it to the PSVITA?
    • If there's no current way to do this, do I essentially have to
      rebuild the Lua Player Plus modules, like `Control` and
      `Graphics` for use on my computer?
  • Are stack traces supposed to be present and I'm just missing
    something? Or would I have to write up my own stack trace
    functionality?
  • Is there some way to quickly update game files on the PSVITA? For
    instance, when I navigate to my homebrew's directory on the PSVITA
    (inside of ux0:/app), I can see that the lua script itself is
    inside of the directory. Can I just swap out this script instead
    of reinstalling the whole application?
    • Further, could I do this while the application itself is
      running? Specifically, if the application has hit an error,
      and I now have the option of restarting and/or starting an FTP
      server. If my application hits an error, then I start an FTP
      server through the application, then replace my lua script, and
      then restart the application, should I expect to just see the
      new code running? Or is this something dangerous to do, and
      ought to be avoided?
Advertising

beelzebielsk
Posts: 3
Joined: Wed Jan 03, 2018 6:20 pm

Re: Lua Player Plus: Debugging Lua Scripts Quickly

Post by beelzebielsk » Wed Jan 03, 2018 8:25 pm

I found a little bit of extra informaton after digging around. I think that directly swapping the lua scripts would be safe.

The location of the actual installed application is in

Code: Select all

ux0:/app
. I figure that there might be some files that I can ignore, like the files for the background of the application, or for the application's bubble.

If there's some dangerous/undesirable behavior that could be caused by swapping the scripts directly, it would have to be reflected somehow in the application code itself. Basically, there would have to be a change that happens to the application code when doing a proper install that doesn't happen when swapping scripts directly; otherwise, the exact same sequence of actions would happen, since the VITA is a deterministic machine.

So, if the only change between version to version of my application is the lua scripts, then I can probably assume that directly swapping out the lua scripts is reasonably safe. I dunno about swapping them during runtime after hitting an error, but swapping just a script instead of sending a whole package and reinstalling would be much faster.
Advertising

User avatar
Rinnegatamante
VIP
Posts: 734
Joined: Sat Mar 26, 2011 10:02 am
Contact:

Re: Lua Player Plus: Debugging Lua Scripts Quickly

Post by Rinnegatamante » Fri Jan 05, 2018 11:13 pm

beelzebielsk wrote:
Wed Jan 03, 2018 6:59 pm
I've just found LPP and I'm trying to make a few games with it.
However, debugging is prohibitively slow, as I'm making a lot of
mistakes.
  • There's no stack trace when I hit an error. I know where the error
    actually happened, but I have no idea how I got to the error.
  • Each time I have to change something, it seems that I have to
    rebuild the whole vpk and re-install it.
So, the questions I have are:
  • Is there already some way to test these lua scripts on my computer
    before sending it to the PSVITA?
    • If there's no current way to do this, do I essentially have to
      rebuild the Lua Player Plus modules, like `Control` and
      `Graphics` for use on my computer?
  • Are stack traces supposed to be present and I'm just missing
    something? Or would I have to write up my own stack trace
    functionality?
  • Is there some way to quickly update game files on the PSVITA? For
    instance, when I navigate to my homebrew's directory on the PSVITA
    (inside of ux0:/app), I can see that the lua script itself is
    inside of the directory. Can I just swap out this script instead
    of reinstalling the whole application?
    • Further, could I do this while the application itself is
      running? Specifically, if the application has hit an error,
      and I now have the option of restarting and/or starting an FTP
      server. If my application hits an error, then I start an FTP
      server through the application, then replace my lua script, and
      then restart the application, should I expect to just see the
      new code running? Or is this something dangerous to do, and
      ought to be avoided?
- As you said, you can directly fix your lua script in ux0:app/TITLEID. Fixing in runtime too should be relatively safe but depending on when the crash happened, it could cause strange behaviours. (For example if the code crashed during sound reproduction).

- Lua scripts can't be tested on PC atm but RPCS3 is adding Vita support. Homebrews should be loadable in few weeks i think.

- As for debugging on PC, i wrote long time ago a minimalist lpp-3ds debugger for PC that far from being complete. That's essentially the way to go to have lpp-vita code running on PC without a Vita emulator.
https://github.com/Rinnegatamante/lppd-3ds
If you want, visit my website: http://rinnegatamante.it :D

beelzebielsk
Posts: 3
Joined: Wed Jan 03, 2018 6:20 pm

Re: Lua Player Plus: Debugging Lua Scripts Quickly

Post by beelzebielsk » Thu Jan 18, 2018 7:35 am

When you say SDL, do you mean https://www.libsdl.org/? Also, I noticed on my package manager, there's both an SDL, and SDL2. Which did you use? Lastly, how did you get started with SDL? Got any resources to recommend?

I'd still like to try my hand at making a homebrew game, and I'd still like the convenience of debugging it on my computer. The game I have in mind is pretty simple, so I think I can get away with just doing a subset of LPP's functionality on the PC.

User avatar
Rinnegatamante
VIP
Posts: 734
Joined: Sat Mar 26, 2011 10:02 am
Contact:

Re: Lua Player Plus: Debugging Lua Scripts Quickly

Post by Rinnegatamante » Thu Jan 18, 2018 7:31 pm

beelzebielsk wrote:
Thu Jan 18, 2018 7:35 am
When you say SDL, do you mean https://www.libsdl.org/? Also, I noticed on my package manager, there's both an SDL, and SDL2. Which did you use? Lastly, how did you get started with SDL? Got any resources to recommend?

I'd still like to try my hand at making a homebrew game, and I'd still like the convenience of debugging it on my computer. The game I have in mind is pretty simple, so I think I can get away with just doing a subset of LPP's functionality on the PC.
SDL and SDL2 are the same, just fit with the one it looks simpler for you. SDL is SDL1.2 btw.
As for resources, there's official documentation and lots of tutorials about SDL on the net.
lppd-3ds btw has been wrote with SDL1.2.
If you want, visit my website: http://rinnegatamante.it :D

Post Reply

Return to “Programming and Security”