Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Problem with dot syntax with @classmod tag using ldoc
Started by ldurniat Mar 05 2018 12:33 PM

- - - - -
4 replies to this topic
ldoc classmod documentation
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

ldurniat

[GLOBAL: userInfoPane.html]
ldurniat
  • Contributor

  • 389 posts
  • Corona SDK

Hi,
 
All class methods are presented using colon syntax in documentation no matter which syntax occur in source files.
 
Example
 
test.lua
--- myClass.lua
-- Description 
--
-- @classmod  myClass


local myClass = {}


--- Desc of function1
function myClass:enableDebugMode()
self.berryDebugModeEnabled = true
end


--- Desc of function2
function myClass.loadMap()
self.berryDebugModeEnabled = false
end 
return myClass

Result

 

O0IB2L4.png

 

I use ldoc 1.4.6-2 installed as rock on Win 7 64-bit.
 
ldurniat


[TOPIC: post.html]
#2

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Contributor

  • 814 posts
  • Corona SDK

You might have some luck with

--- Desc of function2
-- @function myClass.loadMap
function myClass.loadMap()
self.berryDebugModeEnabled = false
end

At any rate, it works in similar circumstances, say when assigning to a variable.



[TOPIC: post.html]
#3

ldurniat

[GLOBAL: userInfoPane.html]
ldurniat
  • Contributor

  • 389 posts
  • Corona SDK

You might have some luck with

--- Desc of function2
-- @function myClass.loadMap
function myClass.loadMap()
self.berryDebugModeEnabled = false
end

At any rate, it works in similar circumstances, say when assigning to a variable.

 

Before I wrote here I have found this trick on github page. It don't work for me. So I think there is no other way I need manually fix it.



[TOPIC: post.html]
#4

davebollinger

[GLOBAL: userInfoPane.html]
davebollinger
  • Corona Geek

  • 1,348 posts
  • Enterprise

i think you may have another more serious problem here:  what is the current meaning of "self" inside myClass.loadMap()

 

A:  either an error, attempt to reference 'nil'; or worse, a global leak of some other assignment to "_G.self" from who-knows-where.

 

loadMap either needs an explicit self parameter to call it with a colon later, or needs to be defined with the colon (giving implicit self)

 

ie, I think ldoc may be doing you an unintended favor, by identifying a function that references self, but isn't declared in that form



[TOPIC: post.html]
#5

ldurniat

[GLOBAL: userInfoPane.html]
ldurniat
  • Contributor

  • 389 posts
  • Corona SDK

i think you may have another more serious problem here:  what is the current meaning of "self" inside myClass.loadMap()

 

A:  either an error, attempt to reference 'nil'; or worse, a global leak of some other assignment to "_G.self" from who-knows-where.

 

loadMap either needs an explicit self parameter to call it with a colon later, or needs to be defined with the colon (giving implicit self)

 

ie, I think ldoc may be doing you an unintended favor, by identifying a function that references self, but isn't declared in that form

Everything is fine but thanks for vigilance:)

 

My true loadMap function don't use self key word. I changed piece of my code to demonstrade my problem. 




[topic_controls]
[/topic_controls]