file:write(string.format("%d,%d,%d", positionx,positiony,positionz)))
local positionVoc2 = {x = 12, y = 22, z = 7}
local format = "%d, %d, %d"
print(format:format(positionVoc2.x, positionVoc2.y, positionVoc2.z))
string.format doesn't print, it just returns the formated string, you'll need a separate means to print the results such as print, io.write or one of the TFS functions/metamethods depending on the need.LUA:local positionVoc2 = toPosition local descriptionVoc2 = string.format( '%d, %d, %d', positionVoc2.x, positionVoc2.y, positionVoc2.z )
no working when we move item inside our backpack (myself)
print(string.format("%d, %d, %d",1,2,3))
-- 1, 2, 3
string.format doesn't print, it just returns the formated string, you'll need a separate means to print the results such as print, io.write or one of the TFS functions/metamethods depending on the need.
LUA:print(string.format("%d, %d, %d",1,2,3))
file:write(" .. descriptionVoc2 .. ")
file:write("moved to his own backpack")
in your case it worked because you already set the specific positionJust add a print(descriptionVoc2)??
I al tried this in a lua online and worked...Code:local positionVoc2 = {x = 12, y = 22, z = 7} local format = "%d, %d, %d" print(format:format(positionVoc2.x, positionVoc2.y, positionVoc2.z))
This is incorrect, it should be:srry, its not for print, is for write:
LUA:file:write(" .. descriptionVoc2 .. ")
I need something like, if its our backpack equiped then write:
LUA:file:write("moved to his own backpack")
file:write( descriptionVoc2 )
That would write the table string representation, not the actual contentThis is incorrect, it should be:
But that is only if you opened a file for writing.Code:file:write( descriptionVoc2 )
This is incorrect, it should be:
But that is only if you opened a file for writing.Code:file:write( descriptionVoc2 )
I was just correcting the code, i never considered the value since it was not immediately available in the post.That would write the table string representation, not the actual content
To make the concat you have to do it outside the "" :I'm using more texts there, thats why
file:write("some text, " " .. descriptionVoc2 .. " ".")
the current script is writing something like toPos: 65535, 64, 2
file:write("some text, " .. varToConcat .. ".")
You will get an error because you have 3 strings which are not connected.I'm using more texts there, thats why
file:write("some text, " " .. descriptionVoc2 .. " ".")
the current script is writing something like toPos: 65535, 64, 2
ile:write("some text, " " .. descriptionVoc2 .. " ".")
file:write("some text, " .. descriptionVoc2 .. ".")
We are trying to teach you something.. rather I am trying to teach you something but if you feel my efforts are a waste of your time I can find better things to do with mine.omg guys, I only need to know how to print the position when the position is ourself (our backpack)
I see here its like something toPosition.y- 64 (our backpack equiped)
this will print:Think of it this way for every string that connects to something else such a variable 2 dots should link them.
So this
becomes thisLUA:ile:write("some text, " " .. descriptionVoc2 .. " ".")
LUA:file:write("some text, " .. descriptionVoc2 .. ".")
local descriptionVoc2 = string.format(
'%d, %d',
positionVoc2.x-65535, positionVoc2.y-64
)
That is the position. I remember that 65535 was the x position when i was checking an items position inside the backpack. I think there is some thread explaining more on the subject, you have to search since i dont have a link to it.this will print:
![]()