whichfere.blogg.se

Lua table insert at position
Lua table insert at position










But I'm showing it this time, because it allows easier customisation and loading from an external (text) file. It's not neccessary to put the coordinates in a table. So actually this tells the Lua engine to run that line with each v(alue) from the table until it reaches the end of the table, which in our case is three times (= 3 mobs!). Because we're using in pairs it'll go through all of the table and use all of the values. The values are the elements in the CreatureID table. Then we proceed to spawn a creature with entryid v which is value. PUnit:SpawnCreature(v, coordslocation+math.random(-5,5), coordslocation+math.random(-5,5), coordslocation, coordslocation, FACTION, DURATION)First of all we're putting the table in pairs again. The information gets stored in an organised way in the drawers assigned to keys or indexes. It's not like a 'variable' though, which can only contain a single piece of information, because a table has 'drawers' which allows a table to store much more information, each apart of each other, while they all can still be called by the table's name. In our case of tables a table is the closet in which you store your information in. But together they are part of a much greater whole. What are tables? See it as a sort of closet with various drawers.

LUA TABLE INSERT AT POSITION HOW TO

This guide will cover the basic aspects of tables and how to use them, I hope you'll enjoy reading it and may it be of any use to you. Lua is far stronger than that and is capable at more than you'd think, especially in use with the GuaEngine (or any 'upgraded' engine). Lua at MMOwned isn't very complex, and it only covers certain (basic) aspects of Lua scripting, in terms of guides and releases (besides some exceptions). I am writing this (small) introduction to tables, because at a certain point I felt I had 'mastered' the Lua used of WoW scripting, however I couldn't be any more wrong. : This guide's written with in mind that you have at least a basic knowledge of Lua.










Lua table insert at position