Hi, i need some help ! Please see the following code
useRetina = true
if useRetina then
local formNeuText = ""
local btOffset = -5
print ("btOffset: " .. btOffset)
else
local formNeuText = languageTable[def\_new2]
local btOffset = 5
end
print ("btOffset: " .. btOffset)
the second print results in a runtime error (nil value).
Any ideas ?
Thx Klaus [import]uid: 5456 topic_id: 11163 reply_id: 311163[/import]
Your btOffset is out of scope by the time you reach your second print statement. It’s scope is local to that first if statement block.
Change your code to this:
useRetina = true
local btOffset = 0
if useRetina then
local formNeuText = ""
btOffset = -5
print ("btOffset: " .. btOffset)
else
local formNeuText = languageTable[def\_new2]
btOffset = 5
end
print ("btOffset: " .. btOffset)
[import]uid: 5833 topic_id: 11163 reply_id: 40491[/import]
thanks
[import]uid: 5456 topic_id: 11163 reply_id: 40494[/import]
No problem! [import]uid: 5833 topic_id: 11163 reply_id: 40502[/import]