npc = { " -------- ", "| |", "| |", " --------", "Merchant" } function printM() print(npc) end printM()i no this is nooby but i need help! (you will be in credits of my game
2
Need a real pro - Tables Error
Started by LuaEclipser, Feb 20 2013 03:48 PM
14 replies to this topic
#1
Posted 20 February 2013 - 03:48 PM
Well I Had This Code and when i try to print the Merchant it gives me Table:RANDOM #s
#2
Posted 20 February 2013 - 03:57 PM
Thanks All1!
#3
Posted 20 February 2013 - 04:02 PM
npc = { " -------- ", "| |", "| |", " --------", "Merchant" } function printM() for i,v in pairs(npc) do print(v) end end printM()untested but it should work
#4
Posted 20 February 2013 - 04:03 PM
for i=1, #npc do
print(npc[i])
end
You have to print the string at each index of the table.
print(npc[i])
end
You have to print the string at each index of the table.
#5
Posted 20 February 2013 - 04:08 PM
Thank You Guys! Creds to both you
one more question
what if i want to print the guy in certain places on the map (or even randomly move!)
sorry if i am wasting your time
one more question
what if i want to print the guy in certain places on the map (or even randomly move!)
sorry if i am wasting your time
#6
Posted 20 February 2013 - 04:12 PM
that gets a little complicated
basically you have two options:
basically you have two options:
- add spaces to the beginning of each line to get the horizontal position and print nothing to get the vertical position
- or you could set the position of the cursor for each line to where the next line should be
#7
Posted 20 February 2013 - 04:14 PM
or could write it all to a function ,"
#8
Posted 20 February 2013 - 04:18 PM
any ideas how to make them all move around and print maps?
#10
Posted 20 February 2013 - 04:44 PM
Thank You ^^
#12
#13
Posted 26 February 2013 - 03:15 PM
LuaEclipser, on 26 February 2013 - 03:14 PM, said:
BigSHinyToys, on 20 February 2013 - 04:26 PM, said:
umm ya i got this error message while running this
i copyed it PERFECTYLE ----
( at line 31 expected t oclose ) at line 30
my code ----
http://pastebin.com/ggTeYTAx
#14
Posted 26 February 2013 - 08:22 PM
#15
Posted 01 March 2013 - 12:43 PM
thank you alot! you have helped me soooo much
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users