Since you're completely new (and asked to be treated as such) I'll start with a basic introduction to the structure of a DSB dungeon directory. There is a
startup.lua which is run on load, an
objects.lua that is run after all the initialization is done and the objects for the game are being set up, and finally a
dungeon.lua, which contains the actual dungeon layout.
Any custom code you may write should be put in
startup.lua, or in files that are loaded after
startup.lua through the use of a
lua_manifest. You shouldn't put code directly into
dungeon.lua. In fact, if you're using ESB, there isn't a whole lot of need to even open
dungeon.lua by hand, and the Lua that ESB produces isn't exactly friendly for doing so.
I'll answer your questions, though that explanation may have made some of them redundant. Just to be sure, I'll answer them all anyway.
Gambit37 wrote:Can I write stuff by hand in here, in any order, and it will work in ESB OK?
Yes, for the most part, though I'll admit that I've not made any extensive modifications to an ESB-generated
dungeon.lua.
Gambit37 wrote:What rules does ESB use to determine the order to write the dsb_spawns in? (RTC bases it on coordinates, starting at the top left of the dungeon and working down to the lower right.)
ESB does the same thing.
Gambit37 wrote:Is the order and content of this file preserved when editing in ESB? Can I add comments to the LUA by hand and they will be preserved after a roundtrip through the editor and back to hand coding?
No, it completely obliterates the file.
Gambit37 wrote:ESB appears to create items and exvars with incremental integer IDs. That's not very friendly for later finding stuff in the text file. Can we set our own prefixes and/or format for these IDs?
No, they're just integers, because this is their internal identifier number.
Gambit37 wrote:Will I learn enough LUA for building dungeons simply from working with the examples provided, or do I actually need to learn LUA first?
I think you'll probably learn enough just playing around with the examples. Lua is a pretty "learn by doing" language and the learning curve isn't that steep once you get over the first few bumps. You don't need to use a lot of the advanced features to make use of DSB. (Indeed, because I "learned by doing" while writing DSB, DSB itself doesn't really make use of a lot of the advanced features!)