Chaosforge Forum

  • December 21, 2024, 06:23
  • Welcome, Guest
Please login or register.



Login with username, password and session length
Pages: [1]

Author Topic: Level modding and syntax preference  (Read 6242 times)

yaflhdztioxo

  • Programmer
  • Local Inquisitor
  • Captain
  • *
  • *
  • Offline Offline
  • Posts: 298
  • Lost Sole
    • View Profile
Level modding and syntax preference
« on: February 25, 2010, 15:43 »

Just in case you didn't know, modding is now open--in a limited form.  Already work is underway, creating new and exciting levels, and a tutorial is planned as well.  And an argument sort've broke out on this point which hopefully you, the community, can resolve :)

In Lua (the language mods are written in), almost every object is a table.  And Lua is fairly flexible with how you assign tables.  For instance, if I were to create an item, the following approaches are all valid:
Code: [Select]
-- C-style
local new_cell
new_cell        = {}
new_cell.name   = "object"
new_cell.ascii  = ":"
Cells(new_cell)

-- Table style
local new_cell
new_cell = {}
new_cell["name"]  = "object"
new_cell["ascii"] = ":"
Cells(new_cell)

-- Lua style
Cells{
  name  = "object",
  ascii = ":"
}

Which one do you, the community prefer?  It's the form that the wiki pages will use, so choose wisely!
« Last Edit: February 25, 2010, 15:51 by Kornel Kisielewicz »
Logged

Malek Deneith

  • Grand Inquisitor Emeritus
  • Grand Inquisitor
  • Lieutenant General
  • *
  • *
  • Offline Offline
  • Posts: 1256
    • View Profile
Re: Level modding and syntax preference
« Reply #1 on: February 25, 2010, 17:27 »

Lua style. It looks clearer, and uses less space as your own example proves :P
Logged
Inquisition - saving your soul, one bolter shell at a time.
Spoiler: "Hackmaster Kills" (click to show/hide)

Deaven

  • Elder
  • Lance Corporal
  • *
  • *
  • Offline Offline
  • Posts: 22
    • View Profile
Re: Level modding and syntax preference
« Reply #2 on: February 26, 2010, 15:31 »

For the same reasons - Lua.
Logged

thelaptop

  • Chaos Fanatic!
  • Grand Inquisitor
  • Apostle
  • *
  • *
  • Offline Offline
  • Posts: 2530
    • View Profile
Re: Level modding and syntax preference
« Reply #3 on: February 26, 2010, 16:23 »

Scheme style.  Oh wait...

I suppose Lua works...
Logged
I computed, therefore I was.

GenTechJ

  • Tester - DoomRL Staff
  • Elder
  • Sergeant
  • *
  • *
  • Offline Offline
  • Posts: 80
  • Hail to the king baby!
    • View Profile
Re: Level modding and syntax preference
« Reply #4 on: March 02, 2010, 16:51 »

LUA Style, for all the reasons listed above.
Logged

yaflhdztioxo

  • Programmer
  • Local Inquisitor
  • Captain
  • *
  • *
  • Offline Offline
  • Posts: 298
  • Lost Sole
    • View Profile
Re: Level modding and syntax preference
« Reply #5 on: March 02, 2010, 17:12 »

I am clearly outnumbered here.  Oh, woe for the days where coding was procedural and we all knew assembly by heart...
Logged

Kornel Kisielewicz

  • God Hand
  • Apostle
  • *
  • *
  • Offline Offline
  • Posts: 4578
    • View Profile
    • http://chaosforge.org/
Re: Level modding and syntax preference
« Reply #6 on: March 02, 2010, 18:53 »

yaflhdztioxo, told you so... but you wouldn't listen :>

And as a matter of fact this is the style in which DoomRL lua files are written... so I guess that is final :)
« Last Edit: March 02, 2010, 18:54 by Kornel Kisielewicz »
Logged
at your service,
Kornel Kisielewicz

Madtrixr

  • Elder
  • Lieutenant Colonel
  • *
  • *
  • Offline Offline
  • Posts: 449
    • View Profile
Re: Level modding and syntax preference
« Reply #7 on: March 07, 2010, 06:58 »

Damnit add. YOu couldn't get your IRC name or something?

Fine, I'm calling you Yaf.
Logged
<Malek_Deneith> What is a PC? A miserable little pile of XP. But enough plot - have at you!

[B/S/G/P/D]
[19/8/5/0/0]
Pages: [1]