Lua Code Blocks (with syntax highlighting)

Bobert13

Prince
Joined
Feb 25, 2013
Messages
346
Any chance of this happening some time between now and the release of Civ VI? :D

I may even be willing to help code the syntax highlighting if an admin/mod could share the PHP code block source and I can make heads or tails of said source. :lol:
 
What are these LUA code blocks?
 
They look like this:

PHP:
Only, with Lua Syntax 'highlighting' instead of PHP...
 
A more detailed and basic explanation might be in order.
 
It's a block designed to contain text. Preferably the text should be some amount of .lua code (from a snippet to a method or maybe even a whole script). The output text in the block would then be highlighted for syntax.

Here's a Code block:
Code:
local thisIsCode = arbitraryValue
if thisIsCode > 9000 then
print("I like Pi!")
else
print(math.pi.." flavored Pi!")
end

Here's what an "Lua Code Block" might look like:
Code:
[COLOR="Blue"]local[/COLOR] thisIsCode [COLOR="DarkOrchid"]=[/COLOR] arbitraryValue
[COLOR="Blue"]if[/COLOR] thisIsCode [COLOR="DarkOrchid"]>[/COLOR] [COLOR="DarkOrange"]9000[/COLOR] [COLOR="Blue"]then[/COLOR]
[COLOR="DarkOrchid"]print[/COLOR]([COLOR="Gray"]"I like Pi!"[/COLOR])
[COLOR="Blue"]else[/COLOR]
[COLOR="DarkOrchid"]print[/COLOR]([COLOR="LightBlue"]math.pi[/COLOR][COLOR="DarkOrchid"]..[/COLOR][COLOR="Gray"]" flavored Pi!"[/COLOR])
[COLOR="Blue"]end[/COLOR]

Lua is the scripting language used in Civ V and Civ BE, if you aren't aware, so over in the mods sections we post Lua code quite often...
 
I'm only aware of Lua from Garry's Mod. This is the first I've heard it implemented in CivV and BE.
 
Lua is the scripting language used in Civ V and Civ BE, if you aren't aware, so over in the mods sections we post Lua code quite often...
Ah! I have neither of those games. So, what you mean is you want to properly visualise those in-forum to share with other modders. Sounds like a great idea, if the admins see it.
 
I'm only aware of Lua from Garry's Mod. This is the first I've heard it implemented in CivV and BE.
Oh yes. There's a whole subforum of the Civ5 modding forum devoted to lua. Lua basically replaced the Python scripting used in Civ4 - UI, map generation, you name it.

To that point, as long as we're proposing a new code block type for lua, why not for every language? Although that's extremely excessive, because we'd probably have over 10 different types of code blocks, so why do it at all? I think the normal blocks work just fine. :dunno:
 
How about we just hit the high points... The two or three most commonly posted languages get their own block. :thumbsup: Especially if they're significantly easier to follow with syntax highlighting (so disclude XML and maybe SQL too; they're pretty simple and the structure of their code covers most of the syntax).

I hate having to copy and paste someone else's code to np++ just to be able to make sense of it in a timely manner. :mad:
 
Well, because I'm aware that across various civ games, the code has been written partly in Lua, but also in C++, XML, SQL, python, and then I have no idea what the first 3 civ games were written in but I'm gonna guestimate that those add at least two more languages to the mix. So... make of that what you will. Which other two languages would get their own code block?
 
Back
Top Bottom