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 :)/>
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Need a real pro - Tables Error
Started by LuaEclipser, 20 February 2013 - 02:48 PMPosted 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
Posted 20 February 2013 - 03:57 PM
Thanks All1!
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 workPosted 20 February 2013 - 04:03 PM
for i=1, #npc do
print(npc)
end
You have to print the string at each index of the table.
print(npc)
end
You have to print the string at each index of the table.
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
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
Posted 20 February 2013 - 04:14 PM
or could write it all to a function ,"
Posted 20 February 2013 - 04:18 PM
any ideas how to make them all move around and print maps?
Posted 20 February 2013 - 04:26 PM
This program does what you want.
http://pastebin.com/ggTZXsyh
http://pastebin.com/ggTZXsyh
Posted 20 February 2013 - 04:44 PM
Thank You ^^
Posted 20 February 2013 - 08:18 PM
This is my personal favorite way to do stuff. Always works for this purpose. :)/>for i=1, #npc do
print(npc)
end
You have to print the string at each index of the table.
Posted 26 February 2013 - 03:14 PM
This program does what you want.
http://pastebin.com/ggTZXsyh
umm ya i got this error message while running this
i copyed it PERFECTYLE —-
( expected to close )
Posted 26 February 2013 - 03:15 PM
This program does what you want.
http://pastebin.com/ggTZXsyh
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
Posted 26 February 2013 - 08:22 PM
http://pastebin.com/H0bSVFZA
Found a few problems with your code fixed.
Found a few problems with your code fixed.
Posted 01 March 2013 - 12:43 PM
thank you alot! you have helped me soooo much