string - Detecting if a variable can be printed in Lua -


i've got variable number of types - it's string, number, table or bool. i'm trying print out value of variable each time this:

print("v: "..v) 

with v being variable. problem is, when value can't concatenated error:

myscript.lua:79: attempt concatenate table value

i've tried changing in case manages detect whether or not variable can printed:

print("v: "..(v or "<can't printed>")) 

but had same problem there. there sort of function can use determine if variable can concatenated string, or better way of printing out variables?

you can provide values separate arguments print:

print("v:", v) 

this print like

v:  table: 006ce900 

not useful, better crash if it's debugging purposes.

see here information on more useful table printing.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -