HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Small vJass glitch

08-01-2008, 04:36 AM#1
Feroc1ty
Collapse JASS:
private function time takes nothing returns nothing
    local spelldata a = spelldata.create()
    set a.time = 0.00
    call a.destroy()
endfunction

When you name a private function a name that a struct contains inside a scope, and attempt to change the value, it thinks that the variable is a function, which in turn tries to make the following code into this:

Collapse JASS:
function grenade__time takes nothing returns nothing
    local grenade__spelldata a = grenade__spelldata.create()
    set a.grenade__time = 0.00
    call a.destroy()
endfunction

Than it tells you that a.grenade__time is not a member of the struct.


Don't know if it's already known...
08-01-2008, 07:51 AM#2
Ammorth
I would assume that is because you are using the same name twice. I good rule of thumb with programing (unless you are trying to make a work-around for something) is to keep all names different from each other, even if they are used for different things (for example, a variable and a function name).
08-01-2008, 01:02 PM#3
Anitarf
If you followed Blizzard's naming conventions, the function would have been called Time, not time, and you wouldn't have this problem.
08-01-2008, 03:07 PM#4
Feroc1ty
It's not a problem, don't understand why everyone keeps saying it's my fault, it's as simple as changing the name(if you didn't realize), I was simply doing my things, and came up upon this, not like I'm asking "Please tell me to how to fix this," I'm simply stating that there is a small glitch.
08-01-2008, 04:44 PM#5
Vexorian
It's not really a glitch, it is just something about scopes' public/private, they are right now implemented as a text replace for keywords, they are not aware of the keywords being used by functions, locals or beign member assigments from structs far away. They are just a text replace, I wish it was better than that, but that's what we got right now.