Page 1 of 2
Scripting Language
Posted: Thu Oct 23, 2014 9:31 pm
by Hermundure
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?
Re: Scripting Language
Posted: Thu Oct 23, 2014 9:34 pm
by Ixnatifual
Re: Scripting Language
Posted: Thu Oct 23, 2014 10:29 pm
by Hermundure
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
Re: Scripting Language
Posted: Thu Oct 23, 2014 11:02 pm
by Isaac
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:
Parentheses ~in this context... indicate a function call, and parameters for that function can be included within those parentheses.
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
Posted: Thu Oct 23, 2014 11:16 pm
by NutJob
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~
Re: Scripting Language
Posted: Fri Oct 24, 2014 8:31 am
by Hermundure
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
Re: Scripting Language
Posted: Fri Oct 24, 2014 12:32 pm
by Komag
Not being a programmer, I've not yet understood why arrays often start with 0
Re: Scripting Language
Posted: Fri Oct 24, 2014 12:37 pm
by NutJob
Then if you're ever extremely bored some day you'll
have this to read.
Re: Scripting Language
Posted: Fri Oct 24, 2014 2:22 pm
by petri
Komag wrote:Not being a programmer, I've not yet understood why arrays often start with 0
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 1

Re: Scripting Language
Posted: Fri Oct 24, 2014 2:33 pm
by Isaac
petri wrote:Komag wrote:Not being a programmer, I've not yet understood why arrays often start with 0
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 1

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.
*(Coming from someone with
VB6 still.)