Jump to content

Recommended Posts

Posted

Hi,

 

In my lua code i use

function class:GetTerrain(world)
local terrain
for terrain in iterate(world.terrains) do
 return terrain
end
end

 

in:

 

function class:CreateObject(model)
local object=self.super:CreateObject(model)
local terrain = class:GetTerrain(model.world)
end

 

But i get the error message:

"attempt to call global 'iterate' (a nil value)" at the for-loop.

 

this error occures after i loaded the map where a object of this type exists, or when im adding a new object to my map (but its gone when i placed a road-node once)

 

can anyone help me get rid of it?

Posted

are you using:

require("scripts/linkedlist")

 

that is needed for the iterate() function... and its the reason why it doesn't occur when you place a road node, as it uses the linkedlist.lua script

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Posted

yes, im using linkedlist..

 

require("Scripts/class")
require("Scripts/Math/math")
require("scripts/linkedlist")

 

the strange thing is, that it also doesnt occur with my object after i placed a road-node.. (also if i deleted the road node again)

Posted (edited)

It looks like something wrong with including "linkedlist".

 

Try to copy/paste this line from road_node.lua:

require("Scripts/linkedlist")

 

And check paths.

Edited by Daimour

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...