1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
=========================================
When running netbox call on remote server
=========================================
debug.sourcefile() => cdata<void *>: NULL; nil
debug.sourcedir() => .; nil
==================================
When running lua code from console
==================================
Exec: tarantool -e "print(debug.sourcefile()); os.exit(0)"
nil
Exec: tarantool -e "print(debug.sourcedir()); os.exit(0)"
.
Exec: tarantool -e "print(debug.__file__); os.exit(0)"
nil
Exec: tarantool -e "print(debug.__dir__); os.exit(0)"
.
Exec: tarantool -e "print(require('net.box').self:call('debug.sourcefile')); os.exit(0)"
Exec: tarantool -e "print(require('net.box').self:call('debug.sourcedir')); os.exit(0)"
.
Exec: tarantool -e "fn = function() return debug.__file__ end; print(require('net.box').self:call('fn')); os.exit(0)"
Exec: tarantool -e "fn = function() return debug.__dir__ end; print(require('net.box').self:call('fn')); os.exit(0)"
.
Exec: tarantool -e "fn = function() local res = debug.sourcefile(); return res end; print(require('net.box').self:call('fn')); os.exit(0)"
Exec: tarantool -e "fn = function() local res = debug.sourcedir(); return res end; print(require('net.box').self:call('fn')); os.exit(0)"
.
Exec: tarantool -e "print(loadstring('return debug.sourcefile()')()); os.exit(0)"
nil
Exec: tarantool -e "print(loadstring('return debug.sourcedir()')()); os.exit(0)"
.
Exec: tarantool -e "print(loadstring('return debug.__file__')()); os.exit(0)"
nil
Exec: tarantool -e "print(loadstring('return debug.__dir__')()); os.exit(0)"
.
Exec: tarantool -e "print(loadstring('local res = debug.sourcefile(); return res')()); os.exit(0)"
nil
Exec: tarantool -e "print(loadstring('local res = debug.sourcedir(); return res')()); os.exit(0)"
.
======================================
When running lua code from script file
======================================
Exec: tarantool debug/test.lua
==============================
Source: print(debug.sourcefile())
debug/test.lua
Source: print(debug.sourcedir())
debug
Source: print(debug.__file__)
debug/test.lua
Source: print(debug.__dir__)
debug
Source: print(require('net.box').self:call('debug.sourcefile'))
Source: print(require('net.box').self:call('debug.sourcedir'))
.
Source: fn = function() return debug.__file__ end; print(require('net.box').self:call('fn'))
debug/test.lua
Source: fn = function() return debug.__dir__ end; print(require('net.box').self:call('fn'))
debug
Source: fn = function() local res = debug.sourcefile(); return res end; print(require('net.box').self:call('fn'))
debug/test.lua
Source: fn = function() local res = debug.sourcedir(); return res end; print(require('net.box').self:call('fn'))
debug
Source: print(loadstring('return debug.sourcefile()')())
debug/test.lua
Source: print(loadstring('return debug.sourcedir()')())
debug
Source: print(loadstring('return debug.__file__')())
nil
Source: print(loadstring('return debug.__dir__')())
.
Source: print(loadstring('local res = debug.sourcefile(); return res')())
nil
Source: print(loadstring('local res = debug.sourcedir(); return res')())
.
|