Adding entry to table, working?
Posted: Mon Mar 24, 2014 12:20 am
Hello,
I am trying to fix a problem caused by the fact that both Dytech and MoCombat completely redefine the entire bitter spawner's "result_units", just to add their bitter(s) to the list. Well, dytech redefines the spawner entirely instead, but that changes very little to the problem.
The problem is that the changes of the first to load (in that case dytech) are overriden.
A quick search around lua's wiki about tables gave me a pretty easy answer, but I need to make sure it is actually working or not.
The 'solution' is obviously
My question now is how to check if this actually worked or not.
My guess so far went into:
I really don't have a clue on how to check the values in the table during the game, to verify if the line has been added or not.
I am trying to fix a problem caused by the fact that both Dytech and MoCombat completely redefine the entire bitter spawner's "result_units", just to add their bitter(s) to the list. Well, dytech redefines the spawner entirely instead, but that changes very little to the problem.
The problem is that the changes of the first to load (in that case dytech) are overriden.
A quick search around lua's wiki about tables gave me a pretty easy answer, but I need to make sure it is actually working or not.
The 'solution' is obviously
Code: Select all
table.insert(data.raw["unit-spawner"]["biter-spawner"].result_units,
{"medium-spitter", 0.35});
My guess so far went into:
Code: Select all
remote.addinterface('testing', {
get = function ()
//Try to get the property
game.player.print(game.entityprototypes["biter-spawner"].result_units)
return "empty"
end
})