I am building a feature to call up individual armour strength and value from a table. I want each table key to be the "name" of that armour, this is so it will be more efficient with triggers to capture what I am wearing, for example (trigger is just an example on what i'll match, not a real trigger):
The above just demonstrates why I want to use multi-worded key values, the issue I'm having is the print function won't read the "wearing" string as a table key.
Here is my table:
When I try to print a value from the shield or helmet key, it comes up saying the key has a nil value. Here is what I've tried so far:
Help please, as always thank you in advance.
P.S Am I better off making an excel/access database and setting up a COM object to call the data in from there?
A shield (worn).
A helmet (worn).
<trigger>
match = "^\W+. \(worn\)\."
regex = "y"
pattern = "
wearing = wildcards[1]
print(armour.wearing.value)
"
<\trigger>
The above just demonstrates why I want to use multi-worded key values, the issue I'm having is the print function won't read the "wearing" string as a table key.
Here is my table:
armour = {}
armour = {
["A shield"] = { strength = 100, value = "200" },
["A helmet"] = [ strength = 200, value = "150" }
}
When I try to print a value from the shield or helmet key, it comes up saying the key has a nil value. Here is what I've tried so far:
print(armour.A shield.value)
print(armour."A shield".value)
print(armour.["A shield"].value)
name = "A shield"
print(armour.name.value)
for k,v in pairs(armour) do
print(armour.k.value)
end
Help please, as always thank you in advance.
P.S Am I better off making an excel/access database and setting up a COM object to call the data in from there?