| Message |
Ah. I think I got the basics of using that string.format. Thanks Nick!
I'm still a little lost on the wildcards -
Say for instance I wanted to be able to look up race information based on the master race, I would provide this when I typed the alias like:
lookup Dwarves
and this would essentially do
"SELECT * FROM race_PC WHERE Race = Dwarves"
Your example also added (string.format to the mysql query, which my script currently does not. It currently looks like:
ur = assert (con:execute("SELECT * from race_pc"))
-- print all rows, the rows will be indexed by field names
row = cur:fetch ({}, "a")
while row do
print(string.format("Master Race: %-3s", row.Race))
print(string.format("Name: %-3s Remort: %-3s Size: %-3s", row.Name, row.Remort, row.Size))
print(string.format("Creation Cost: %-3s", row.Creation_Cost))
print("St Qu Pr Em In Co Ag Sd Me Re")
print(string.format("%s, %s, %s, %s, %s, %s, %s, %s, %s, %s", row.Strength, row.Quickness, row.Presence, row.Empathy, row.Intuition, row.Constitution, row.Agility, row.Self_Discipline, row.Memory, row.Reasoning))
-- reusing the table of results
row = cur:fetch (row, "a")
end
Edit: Just saw WillFA's post, will give that a good read and see if I can get anywhere!
|
,.~`'~.,Dance Magic Dance,.~`'~., | top |
|