I'm looking for a bit of help understanding the game's Lua code structure. I tried using the wiki, but it doesn't seem to be very practical. For instance, I was trying to use the object detailed on the wiki at Lua/ItemStack, but I tried putting "/c game.player.print(ItemStack.help())", but this simply resulted in Lua throwing an error that was basically a complaint about trying to execute nil, the Lua equivalent of saying a function or method doesn't exist.
I am about as lost as one can be. This problem has me stumped. Could someone with significantly more experience explain what's going on and what I should've been trying?
Also could someone provide a link to a more comprehensive guide on Lua, because that could be part of my problem (Inexperience with Lua because, prior to this game, I've only ever used Lua with the Minecraft mod ComputerCraft)
Lua help
- Twisted_Code
- Long Handed Inserter
- Posts: 83
- Joined: Sat Jun 06, 2015 1:15 am
- Contact:
Lua help
How to report bugs effectively (archived version)because everyone should know this.
The game's tech tree, a visual reference guide.
The game's tech tree, a visual reference guide.
-
- Filter Inserter
- Posts: 436
- Joined: Wed Jan 15, 2014 9:41 am
- Contact:
Re: Lua help
This is not the best part to ask you this help.
https://forums.factorio.com/forum/viewforum.php?f=25
(mod may mover it there)
ask/tel what you like to do, you get more help.
look at the mod there look at the code.
https://forums.factorio.com/forum/viewforum.php?f=25
(mod may mover it there)
ask/tel what you like to do, you get more help.
look at the mod there look at the code.
Re: Lua help
Moved from Off-Topic.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Re: Lua help
First thing first, I do not think you can call the help() method on the ItemStack that way - ItemStack is nil, it is not referenced or pointing to anything.Twisted_Code wrote:I tried putting "/c game.player.print(ItemStack.help())", but this simply resulted in Lua throwing an error that was basically a complaint about trying to execute nil, the Lua equivalent of saying a function or method doesn't exist.
You would need to get an 'instance' of the an itemstack first and then call the help() method on it. (but I might be wrong).
Second point, ItemStack looks to be a bad example here, because as far as I can see most of the time a SimpleItemStack is being manipulated, which is basically a simple table like so:
Code: Select all
stack = {
name = 'iron-plate',
count = 8
}