Log In  

ok, so I'm stumped. I have a table that works fine when I make it in the command line, but is missing a value when I reference it from cart. There are no errors on load of the cart data.

Here is the table:

bomber={
 spr={33,34,35},
 val=1000,
 aspd=10,
 gun=missile,  -- table
 mov=_circles, -- function
 ebhv=function(self)
  local e=self
  if (e.elite>elitecut) then
   e.val=e.val*4
  end
 end
}

I am using the following command to check the table when loaded:

for k,v in pairs(bomber) do print(k.." "..type(v)) end

Which returns:

aspd number
ebhv function
spr table
val number
mov function

Whereas pasting the table into command line and running that again returns:

aspd number
ebhv function
spr table
gun table
val number
mov function

Finally I made a dummy cart that seems to work as expected.

function check(tbl)
 for k,v in pairs(tbl) do
  print(k.." "..type(v))
 end
end

function pew()
 return null
end

function _circles()
 return null
end

missile={}
missile.n="homing"
missile.f=pew

bomber={
 spr={33,34,35},
 val=1000,
 aspd=10,
 gun=missile, -- table
 mov=_circles, -- function
 ebhv=function(self)
  local e=self
  if (e.elite>elitecut) then
   e.val=e.val*4
  end
 end
}

Cart #yafuziyose-0 | 2021-02-28 | Code ▽ | Embed ▽ | No License

P#88307 2021-02-28 19:51

Figured out the issue. I had the weapon tables inside a function while the enemy tables were just openly declared. Moving them into a function and then declaring after the weapon function fixed it!

P#88313 2021-02-28 20:05

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-16 20:53:12 | 0.012s | Q:15