Scripting Language
-
- Posts: 46
- Joined: Wed Sep 26, 2012 5:44 pm
Scripting Language
Sorry for this dumb question guys, but:
Is the scripting language for Grimrock 2 Lua 5.1 or 5.2?
Do you know any resource for complete starters which can be used to learn this language and get a start-up?
Is the scripting language for Grimrock 2 Lua 5.1 or 5.2?
Do you know any resource for complete starters which can be used to learn this language and get a start-up?
-
- Posts: 46
- Joined: Wed Sep 26, 2012 5:44 pm
Re: Scripting Language
Thank you for this quick answer!
Two more questions just came up:
1.) what does this () mean behind some lines for example here: combination_lever_1.lever:isActivated() or here checkLevers() ?
and 2.) what purpose do these { have in the functions as I often see many of them just below each other for example here:
defineObject {
name = "door_of_closing",
baseObject = "dungeon_door_portcullis",
components = {
{
class = "Door"
}
}
}
Herm
Two more questions just came up:
1.) what does this () mean behind some lines for example here: combination_lever_1.lever:isActivated() or here checkLevers() ?
and 2.) what purpose do these { have in the functions as I often see many of them just below each other for example here:
defineObject {
name = "door_of_closing",
baseObject = "dungeon_door_portcullis",
components = {
{
class = "Door"
}
}
}
Herm
Re: Scripting Language
Parentheses ~in this context... indicate a function call, and parameters for that function can be included within those parentheses.Hermundure wrote:1.) what does this () mean behind some lines for example here: combination_lever_1.lever:isActivated() or here checkLevers() ?
and 2.) what purpose do these { have in the functions as I often see many of them just below each other for example here:
The "Curly Braces" normally indicate a collection of data; a table; array.
eg. myVar = {10,20,30,"goblins"} ; print(myVar[3], myVar[4]) ..... would print: 30 goblins
Re: Scripting Language
The thing that caught me off guard are arrays start at 1. How silly (lua). At least starting at 1 is going very old-school. ~laughs~
-
- Posts: 46
- Joined: Wed Sep 26, 2012 5:44 pm
Re: Scripting Language
Thank you for the infos!
@NutJob
Sorry, I didnt get what you tried to tell me here, which arrays have to start with 1 and why? I am a bit puzzled oO
@NutJob
Sorry, I didnt get what you tried to tell me here, which arrays have to start with 1 and why? I am a bit puzzled oO
Re: Scripting Language
Not being a programmer, I've not yet understood why arrays often start with 0
Finished Dungeons - complete mods to play
Re: Scripting Language
Then if you're ever extremely bored some day you'll have this to read.
Re: Scripting Language
It's a relic from old programming languages like the C language. Of course all sensible languages like Lua start with 1. The 1st item of an array is logically at index 1Komag wrote:Not being a programmer, I've not yet understood why arrays often start with 0

Re: Scripting Language
I'm neutral... but... is it just me or doesn't it seem that starting from 1 has the stigma of VB all over it.petri wrote:It's a relic from old programming languages like the C language. Of course all sensible languages like Lua start with 1. The 1st item of an array is logically at index 1Komag wrote:Not being a programmer, I've not yet understood why arrays often start with 0

*(Coming from someone with VB6 still.)
Last edited by Isaac on Fri Oct 24, 2014 2:40 pm, edited 1 time in total.