Jump to content

Mod crashing due to syntax error - please help!


Ealish

Recommended Posts

So I'm usually OK at decoding the log file, but I can't make head or tail of this one - any help would be greatly appreciated! (I think it's a syntax error, but I just can't find it...!). This mod was working perfectly fine a few weeks ago; I don't remember making any changes since then, but it's decided it doesn't like it any more.

 

I've attached the log file and the .lua it seems to be getting hung up about.

log.txt

nick.lua

Link to comment
Share on other sites

@Ealish,

local master_postinit(inst) = function(inst)

()s tell Lua to execute whatever function is being stored in the variable they're adjacent to.  (With the one exception of when you're defining a function ala somevar = function(arg) or function somevar(arg)

 

The way that Lua interprets that code is effectively:

 

1. Create a new function

2. Store that function inside a new, local variable

3. name that variable EXECUTE THE MASTER_POSTINIT FUNCTION

 

At which point Lua goes "whoa, whoa, say what now? I was just trying to name a variable, calm down."

Link to comment
Share on other sites

@Ealish,

 

either

local master_postinit = function(inst)

or

local function master_postinit(inst)

They both do the exact same thing.  Look toward the top of the file to see how your other postinit function was defined:

local common_postinit = function(inst) 	-- Minimap icon	inst.MiniMapEntity:SetIcon( "nick.tex" )end
Link to comment
Share on other sites

@Corrosive That worked perfectly - thank you very much!

Looking at my Guide to Beards, it turns out I was initially using the correct syntax - I have no idea how or why I changed it, I guess I should learn to follow my own guides... >.<

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...