Jump to content
Alloder.pro: about Allods with love
Search In
  • More options...
Find results that contain...
Find results in...

New program for writers

We turn from quantity to quality and tell you how we will supplement the Allods Team program with rewards in rubles.


The new Updater

Let us to introduce the new addon updater software and to share the details

Read more

Alloder 2.0

We have started the process of project evolve, and this relates not only, and not even primarily of the site's view

Read more

Addons using Class(...)?


Recommended Posts

Has anyone tried (and succeeded in) using the new facilities that came with (around) 3.0?

I'm talking about the stuff in LuaCompiledSystem.pak, specifically Class (Interface\Common\Script\ScriptClassesImplementation.luac) and useful base classes such as widgetObjectMonitor (Interface\Common\Script\ScriptWidgetObjectMonitor.luac) or widgetDynamicList (Interface\Common\Script\ScriptWidgetDynamicList.luac)?

I tried to use them like other scripts do (for example AstralMap), which starts the whole thing by doing something like that:

Class("main", UIBasicElement())

function main:Init()


    -- [...] 

    return UIBasicElement.Init(self)


-- [...] 


...when I try that, main(mainForm) throws a bad argument #1 to `setmetatable' (table expected, got userdata); if I remove mainForm it runs Init - but then self.wtSomeOtherWidget is never set (and I couldnt find any code inside the classes that initializes them based on widgetForm:GetNamedChildren or something).

So, any luck there, or am I the first one to try that?

My main goals in trying to use those things is the magic widgetDynamicList and widgetObjectMonitor work behind the scenes (like widgetDynamicList.Add creating other classes for objectIds or widgetObjectMonitor.Toggle keeping track of busy reaction handlers).

Link to comment
Share on other sites

Well, obviously you can't set metatable to userdata from script, so your mainForm should be a table. Since it's not, and all the widgets we have from client side are userdata, there should be some script (probably within \Interface\Common\Script\) which makes them tables. So link all other scripts from \Interface\Common\Script\ to your add-on and try again. If it does the trick, remove those scripts one by one and restart client until add-on becomes all broken over again. This will leave you with one or several scripts essential for classes to work. My money's in particular on ScriptWidgetCore.luac, since it has funny name. All other possible candidates are far too old, you can get them among ancient scripts from version I've seen 'em somewhere on this forum. Good luck.

Here's some similar thread.

Link to comment
Share on other sites

Oh, neat, I didn't know they were around for that long. I just noticed them after looking around AstralMap and things after the 3.0 update.

I'll take a look at WidgetCore, and its gonna be a lot to reverse.

Link to comment
Share on other sites

Great, it looks like WidgetCore does the trick (you can clearly see how it overrides __index).

For others that are interrested:

<?xml version="1.0" encoding="UTF-8" ?>


  <!-- other stuff -->


   <Item href="/Interface/Common/Script/ScriptWidgetCore.luac" />

   <Item href="/Interface/Common/Script/ScriptClassesImplementation.luac" />

        <!-- your scripts using Class(...) here -->


  <!-- other stuff -->


I've yet to run further tests and see whether my actual code works, but so far it doesnt throw any errors anymore.

Link to comment
Share on other sites

So I was right. Damn, I'm good! © Duke Nukem =)

Well, I got question too. Which tool do you use to decompile scripts? I can't find one that actually works. It seems they all need some kind of debug data included in scripts.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using our site you agree to the Terms of Use