Lua testing environment?

Lua testing environment?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
Aztek
Posts: 36
Joined: 10 Jun 2008, 04:53

Lua testing environment?

Post by Aztek »

Hey,

I'm just getting started with Lua and Spring and I'm wondering what people use for testing Lua widgets. I've just been running a windowed Test Spring session and loading/testing my widgets. If something goes wrong Spring automatically unloads the widget and displays the error in the chat area. I fix it, save the file, unload/load and repeat.

Is this an efficient setup? Is there any way to step through and debug Lua stuff (I don't imagine there is but I figured it's worth asking)?

Thanks,
Aztek
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Lua testing environment?

Post by aegis »

use lots of Spring.Echo and

Code: Select all

.luaui reload
or

Code: Select all

.luarules reload
(depends on what you are testing)
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Lua testing environment?

Post by lurker »

Don't forget that if you want to make a file in an sdd longer midgame, you need to have the end padded with a long comment so it's safe to get cut off at the previous file size. Fixed in svn, I don't know if it applies to the local luaui folder or not.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Re: Lua testing environment?

Post by trepan »

The DoLine widget and gadget are useful for lua dev'ing.
Aztek
Posts: 36
Joined: 10 Jun 2008, 04:53

Re: Lua testing environment?

Post by Aztek »

@aigis: Using Spring.Echo would definitely be useful for debugging, thanks.

What do .luaui reload and .luarules reload accomplish that unloading/reloading a widget doesn't?

@lurker: What does SDD mean here? To me that means Software Design Document, but I doubt that's what you meant.

It appears by what you said that the filesize of your widget is locked by spring so it can't be beyond the original length and you have to restart spring to fix this or pad with a comment to give yourself some breathing room? :?

@trepan: I'll check those out, thanks.

Thanks for the replies.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Re: Lua testing environment?

Post by Peet »

Aztek wrote:@lurker: What does SDD mean here? To me that means Software Design Document, but I doubt that's what you meant.
Spring Data Directory (Is the backronym I've determined, though it could be something else)...it's essentially a content package that is contained in a folder rather than a zip/7zip archive. It uses the same file/folder structure inside a main folder which must end in .sdd.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Lua testing environment?

Post by aegis »

for testing widgets outside of a mod, you won't need to worry about .sdd or padding
Post Reply

Return to “Lua Scripts”