For example,
function test (a)
name = nameof(a)
print(name)
end
test(def) --should print "def"
Are there any lua tricks to implement something similar to the above?
For example,
function test (a)
name = nameof(a)
print(name)
end
test(def) --should print "def"
Are there any lua tricks to implement something similar to the above?
Try using the debug library.
You can use debug.getlocal ([thread,] level, local)
to get information about a local variable, including its name.
What you asking for is not possible in pure Lua.
If you really need this, try fiddling with Metalua.