Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
In other languages like C and javascript, it's important, in Lua [afaik] it's an optional end of statement.
print("hello", "world") is fine, but
print("hello"; "world") is not. Lua expects the ending parentheses of the print statement before the semicolon; and then expects the [next line's] function name of what follows the semicolon before the ending parameter and parenthesis.
Do you know Lua basics? It's useful to learn those before getting too deep into Grimrock modding.
I see,
well, I don't know what constitutes "lua basics"
I do know i've learned a lot over the past couple of weeks but, this is probably why i'm having trouble with this. I never actually "learned" anything about lua before I attempted to make a custom dungeon for grimrock
One doesn't need to learn much about Lua before modding Grimrock, as it's a pretty easy language to pick up. But like spoken languages, it's useful to know the grammar and rules behind how a sentence is constructed.
Browsing the forums, it seems many modders come unstuck on Lua because they've not taken the time to learn its 'grammar' before charging in headfirst. There's a certain amount that can be learned by poking around, but at some point it's wise to read some Lua documentation, otherwise we never get beyond the tinkering stage.
And I agree with Petri: semi colons are ugly. Though I now get really confused when switching between Lua for modding and JavaScript in my day job...
I think the only reason you see them nowadays (apart from when you have multiple statements per line) is force of habit.
As I only bash out Lua here and there, my code is littered with semi-colons, but now I do some Swift coding too - I'm starting to get rid of them. I think it's slightly more visually pleasing without, but as long as it's consistent within a given file - I don't really care either way!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
JohnWordsworth wrote:I think the only reason you see them nowadays (apart from when you have multiple statements per line) is force of habit.
As I only bash out Lua here and there, my code is littered with semi-colons, but now I do some Swift coding too - I'm starting to get rid of them. I think it's slightly more visually pleasing without, but as long as it's consistent within a given file - I don't really care either way!
ahh john wordsworth, you are the creator of the GrimTK gi toolkit aren't you. have you read my other post? i'm having problems getting it to work in my main project, I can make it work perfectly when I create a new projects, but in my main projectI can't get it to recognize the commands