Quick Links:
Download Gideros Studio
|
Gideros Documentation
|
Gideros community chat
|
DONATE
how to print line number & module's name in the Output window — Gideros Forum
Home
Discussions
Sign In
Home
›
General questions
Sign In
·
Register
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Quick Links
Categories
Recent Discussions
Categories
7.8K
All Categories
11
Help with translations
4.2K
General questions
107
Roadmap
358
Game & application design
315
Plugins
70
User experience
75
Marketplace
290
Code snippets
34
Building a team?
269
Suggestions & requests
352
Announce your apps made with Gideros.
90
Step by step tutorials
668
Bugs and issues
195
Introduce yourself
239
Announcements
106
Forum talk
404
Relax cafe
In this Discussion
June 2013
OZApps
June 2013
asakharov
June 2013
AhBadiane
Top Posters
ar2rsawseen
6991
SinisterSoft
4058
hgy29
3644
keszegh
3254
atilim
2892
antix
2136
MoKaLux
2002
OZApps
1983
totebo
1781
oleg
1706
hgvyas123
1412
techdojo
1321
pie
1194
gorkem
1186
rrraptor
1030
phongtt
1029
Mells
1024
MikeHart
1020
john26
995
GregBUG
962
how to print line number & module's name in the Output window
AhBadiane
Member
June 2013
edited June 2013
in
General questions
To make a quick debugging, how to print the next thing "module = main.lua, line = 123" in the Output window
print ("module =" .. intruction1, "line =" .. instruction2)
The line representing the line containing this print()
AhBadiane
+1
-1
Share on Facebook
Comments
asakharov
Member
June 2013
Accepted Answer
function trace()
local info = debug.getinfo(2)
print("module=" ..info.short_src .. ", line=" .. info.currentline)
end
+1
-1
Share on Facebook
AhBadiane
Member
June 2013
thanks
@asakharov
, I really have to immerse myself in the doc LUA
AhBadiane
+1
-1
Share on Facebook
OZApps
Guru
June 2013
edited June 2013
@AhBadiane
, you can also try the following code
< removed code >
twitter:
@ozapps
|
http://www.oz-apps.com
|
http://howto.oz-apps.com
|
http://reviewme.oz-apps.com
Author of Learn Lua for iOS Game Development from Apress (
http://www.apress.com/9781430246626
)
Cool Vizify Profile at
https://www.vizify.com/oz-apps
+1
-1
Share on Facebook
asakharov
Member
June 2013
@OZApps
, I tested my version and yours for 10 millions of traces.
And my code about 10% faster.
+1
-1
Share on Facebook
OZApps
Guru
June 2013
@asakharov
, the code snip was more for usability, any number of print statements will slow down or reduce performance.
twitter:
@ozapps
|
http://www.oz-apps.com
|
http://howto.oz-apps.com
|
http://reviewme.oz-apps.com
Author of Learn Lua for iOS Game Development from Apress (
http://www.apress.com/9781430246626
)
Cool Vizify Profile at
https://www.vizify.com/oz-apps
+1
-1
Share on Facebook
Sign In
or
Register
to comment.
Powered by Vanilla
Comments
local info = debug.getinfo(2)
print("module=" ..info.short_src .. ", line=" .. info.currentline)
end
< removed code >
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
And my code about 10% faster.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps