Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Koneki » LDT - Execution Environment. Help!(variable detection.)
LDT - Execution Environment. Help! [message #1067180] Sun, 07 July 2013 04:51 Go to next message
simon birkedal is currently offline simon birkedal
Messages: 6
Registered: July 2013
Junior Member
Greetings,

I'm trying to develop my own Execution Environment for World of Warcraft(in LDT), so far it works well. Now i'm at the Widget Reference, which requires the following:

myVariable:WidgetAPI, an example would be:

local btn = CreateFrame("Button", "MyButton", UIParent)
btn:SetSize(10, 10)
btn:SetPoint("TOPLEFT", UIParent, "TOPRIGHT")


is there a way to make the execution environment register the widget api according to the variable given in the line before to register which FrameType i selected here: CreateFrame("FrameType", "Name", Parent)

So if the "FrameType" would be something like this instead:

local frame = CreateFrame("Frame", "MyFrame", UIParent)
frame:SetClampedToScreen(true)
frame:EnableMouse(true)
frame:RegisterForDrag(true)


So code assist works as soon as i type, myVariable:


Sorry for my English.. Thank you in advance!

EDIT:
An example:
local frame = CreateFrame("Frame", "BagBuddy", UIParent)
frame:SetSize(425, 425) -- Code Assistant dependent on the FrameType
frame:SetPoint("CENTER", UIParent, "CENTER") -- Same goes here

texture = frame:CreateTexture("Portrait", "BACKGROUND")
texture:SetPoint("TOPLEFT", frame, "TOPRIGHT") -- Code Assistant if above field is myVariable = frame:CreateTexture(...)
texture:SetSize(60, 60) -- Same goes here
texture:SetTexture("Interface\\ICONS\\INV_Misc_EngGizmos_17") -- Same goes here


Or simply by Code Assist everything that has a colon.

[Updated on: Sun, 07 July 2013 05:33]

Report message to a moderator

Re: LDT - Execution Environment. Help! [message #1067309 is a reply to message #1067180] Mon, 08 July 2013 05:26 Go to previous messageGo to next message
Simon Bernard is currently offline Simon Bernard
Messages: 164
Registered: July 2009
Senior Member
Hi,
Currently there are no way to define a function which returns different types according a parameter value.
If we implements this feature, I don't really know how could be the syntax to do that in documentation language Smile.

For now, the only thing you could do is to create all types which could be userfull in your execution environment.
And users of your execution environment should use the explicit typing syntax to type their variables :

local frame = CreateFrame("Frame", "BagBuddy", UIParent) -- yourmodule#frame
frame:SetSize(425, 425) 
frame:SetPoint("CENTER", UIParent, "CENTER") 

local btn = CreateFrame("Button", "MyButton", UIParent)  -- yourmodule#button
btn:SetSize(10, 10)
btn:SetPoint("TOPLEFT", UIParent, "TOPRIGHT")


For the texture sample not sure I understand the point Smile.

Simon

[Updated on: Mon, 08 July 2013 05:27]

Report message to a moderator

Re: LDT - Execution Environment. Help! [message #1067316 is a reply to message #1067309] Mon, 08 July 2013 05:50 Go to previous messageGo to next message
simon birkedal is currently offline simon birkedal
Messages: 6
Registered: July 2013
Junior Member
Thanks for the answer! Smile

Is there maybe a way to add some sort of Regular Expression to it? Because what's really important for what i try to accomplish is that myVariable can be anything in the following:

myVariable:SetOwner

so no matter what i type in myVariable, as soon as i hit :, SetOwner, etc shows in the drop down.

If you have a look at the WoW Reference section for Widgets here: www.wowprogramming.com/docs/widgets

The Alpha, Animation, etc are the standard global values used by Blizzard, but in order to make a succesful AddOn for World of Warcraft - you'll have to define your own.

So my real question is:

Would it be possible to make Code Assist, simply by pressing the :, because you can actually also define a widget which has no name.


EDIT:

Quote:
For the texture sample not sure I understand the point.


Was also a really bad example by me, sorry bout that.

Quote:
local frame = CreateFrame("Frame", "BagBuddy", UIParent)
frame:SetSize(425, 425) -- Code Assistant dependent on the FrameType
frame:SetPoint("CENTER", UIParent, "CENTER") -- Same goes here

texture = frame:CreateTexture("Portrait", "BACKGROUND")
texture:SetPoint("TOPLEFT", frame, "TOPRIGHT") -- Code Assistant if above field is myVariable = frame:CreateTexture(...)
texture:SetSize(60, 60) -- Same goes here
texture:SetTexture("Interface\\ICONS\\INV_Misc_EngGizmos_17") -- Same goes here


In the first part i tell that the local variable "Frame" will create a frame using CreateFrame

now for the second part, i tell that texture is a child to the parent frame. Because i tell that texture is equal to frame:CreateTeture(parameter) i only have to type texture:someFunction(someParameter)..

[Updated on: Mon, 08 July 2013 09:37]

Report message to a moderator

Re: LDT - Execution Environment. Help! [message #1067396 is a reply to message #1067316] Mon, 08 July 2013 09:54 Go to previous messageGo to next message
Simon Bernard is currently offline Simon Bernard
Messages: 164
Registered: July 2009
Senior Member
Sorry, but I'm not sure to understand what you want to do :/.

I take a look to the WOW API and I see two problem :
1)the Class Hierarchy
2)the constructors which is able to create objects of different types.


For the 1) the LDT language does not support inheritance so the documentation must be duplicate for each type (e.g. you must define SetSize for Button, Cooldown and all the child class of Region ... :/)
For the 2) there is the workaround I gave you before. (the explicit typing of local var)

This is clearly 2 limitations of the documentation language, we need to think about a way to resolved this problems. Waiting I hope the workarounds could help you.
Re: LDT - Execution Environment. Help! [message #1067402 is a reply to message #1067396] Mon, 08 July 2013 10:18 Go to previous messageGo to next message
simon birkedal is currently offline simon birkedal
Messages: 6
Registered: July 2013
Junior Member
www.wowprogramming.com/docs/widgets

Now go to e.g. Cooldown and click it(or click here: www.wowprogramming.com/docs/widgets/Cooldown

Inside the cooldown, you'll se that it has 4 defined methods, same goes for each widget and is the only thing you'd actually have to worry about.

The EditBox:
www.wowprogramming.com/docs/widgets/EditBox

This one has 48 defined methods. However some of the other widgets also has some of the functions defined - e.g. GetIndentedWordWrap() can be used by:

ScrollingMessageFrame
EditBox
SimpleHTML
FontString
MessageFrame
and others.

BTW WoWWiki is abit outdated - you should either check WoWPedia.org or WoWProgramming.com (i prefer WoWProgramming because its system is easier to understand IMO)



Not sure if anything i just said has anything to do with what you meant.. But my english is not very good - so please don't find me annoying or anything, i'm not doing this to sound stupid or anything.. really hope you get what i'm trying to achieve. PS LDT Is awesome!

Regards,
fRodzet
Re: LDT - Execution Environment. Help! [message #1067539 is a reply to message #1067402] Tue, 09 July 2013 05:16 Go to previous messageGo to next message
Simon Bernard is currently offline Simon Bernard
Messages: 164
Registered: July 2009
Senior Member
Are you ok with the concept of "type" in the documentation language ?

There are a sample here.
Re: LDT - Execution Environment. Help! [message #1067588 is a reply to message #1067539] Tue, 09 July 2013 09:14 Go to previous messageGo to next message
simon birkedal is currently offline simon birkedal
Messages: 6
Registered: July 2013
Junior Member
Not exactly sure how Type works tbh, i think the documentation is abit meh - for those who's new at this or programming in general.

But i know that if you add a field to the global.lua file which looks something like this:

@field [parent = #global] GameTooltip#GameTooltip GameTooltip

then creating a file named GameTooltip.lua and adding the following content to it:

@module GameTooltip

then you can do:

@function [parent=#GameTooltip] SetOwner
@param self

That would work as supposed to, but only if i use the word GameTooltip and put in a :, SetOwner drops down in the list. And ofcourse it recognizes if i say: local tooltip = GameTooltip, then tooltip and :, would dropdown SetOwner aswell.


But how the metafunction type works - i have no idea, i took a look at the standard io in the 5.1 execution environment, and tried to figure out why type was so important as the documentation says - but i couldn't figure it out.
Re: LDT - Execution Environment. Help! [message #1067632 is a reply to message #1067588] Tue, 09 July 2013 12:59 Go to previous messageGo to next message
simon birkedal is currently offline simon birkedal
Messages: 6
Registered: July 2013
Junior Member
I'd also like to know one thing:

Is it a must have to make a docs folder with an index html in it? In order for a Execution Environment to work?
Re: LDT - Execution Environment. Help! [message #1067712 is a reply to message #1067632] Wed, 10 July 2013 05:14 Go to previous messageGo to next message
Simon Bernard is currently offline Simon Bernard
Messages: 164
Registered: July 2009
Senior Member
The 'type' concept is the key of your problem, you must understand it.
The documentation explain it and they are also a sample as I said before.

Did you try the sample by creating a geometry.lua file with the code of the 2nd sample and in another file, did something like that :
-- load the geometry module in the variable g
local g = require 'geometry'

-- use the newRectangle function of gemotry to create a new rectangle 
local r = g.newRectangle(10,10,10,10)

-- move the rectangle
r:move(2,2)

You will have autocompletion on g and r variables.


You said the documentation is abit meh ... you could propose enhancement...
This documentation aim not to learn the basic in programming and even the basic in lua. Those are prerequisites to understand it.
Re: LDT - Execution Environment. Help! [message #1067721 is a reply to message #1067712] Wed, 10 July 2013 05:49 Go to previous message
simon birkedal is currently offline simon birkedal
Messages: 6
Registered: July 2013
Junior Member
Ty very much - i'll give it a go Smile

I will keep ya updated on how it goes Smile But according to your description of type its starting to make sense Smile Is it possible to make it : instead of the letters A-Z? Smile Also do you know if you can somehow add regular expressions to variables - generally in lua, can't seem to find it.

Then i could do something like: local %a+: = require 'geometry'
Previous Topic:How to do FUMO?
Next Topic:Variable Reference Issue
Goto Forum:
  


Current Time: Tue Jul 29 04:45:43 EDT 2014

Powered by FUDForum. Page generated in 0.02588 seconds