Scripting Resources & Utilities > OpenEUO Scripting Tutorials

Arrays -- What are Arrays ??? a nobama speacil

<< < (3/3)

manwinc:
Also, you can make a dynamic table



--- Code: ---schedule = {
{ "mon", "work", "eat", "hw", "sleep"},
{ "tue", "work", "mow", "run", "Cook"},
{ "Wed", "Pay Bills", "Errands", "Sleep", "Play Video Games"}
}
--- End code ---

and then call it with unpack command


--- Code: ---for i = 1,#schedule
sDay, sFirst, sSecond, sThird, sFourth = unpack(schedule(i))
-- code for checking/doing things here
end
--- End code ---

TrailMyx:
Be careful with the use of "{}", "[]" and "()".  They address identifiers in specific ways.  Since you are referencing a table, you're code should look like this:


--- Code: ---schedule = {
{ "mon", "work", "eat", "hw", "sleep"},
{ "tue", "work", "mow", "run", "Cook"},
{ "Wed", "Pay Bills", "Errands", "Sleep", "Play Video Games"}
}

for i = 1,#schedule do -- added "do"
sDay, sFirst, sSecond, sThird, sFourth = unpack(schedule[i])  -- changed (i) to [i]
-- code for checking/doing things here
end

--- End code ---

Endless Night:

--- Quote from: Endless Night on October 19, 2010, 09:47:19 AM ---
--- Quote from: TrailMyx on October 19, 2010, 09:37:03 AM ---
--- Quote from: Endless Night on October 19, 2010, 09:34:15 AM ---
that explains why i missed it i dont see any hearts

--- End quote ---

You won't see any hearts under your own posts, else you'll be able to give rep to yourself.  That's been known to cause blindness and an acute case of hairy palms.

--- End quote ---

I dont see hearts under any posts in any threads...   unless ive already got the blindness your speaking of I know ive got the hairy palms aready lol

--- End quote ---


My sight has been restored I now see hearts.. thank goodness .. now what to do about these hariy palms umm

manwinc:
Ah yes, my bad tm. I see that now in my own script

local sSkill, nMaxLevel, nMinLevel, nSpell, bTarget, nDelay, nMana = unpack(spells)

Navigation

[0] Message Index

[*] Previous page

Go to full version