Community Forums Today's Posts     Member List     Archive    
Results 1 to 11 of 11

Thread: Lua Autoload?

  1. #1
    Join Date
    Aug 2008
    Location
    Mannheim
    Posts
    16

    Lua Autoload?

    Hello
    my english is not very good

    He is the event in the lua enable equal to start with.

    I have in this folder lua_plugin a folder under lt
    in the folder I have two files
    lua init
    events lua
    lua init:
    Code:
    require("ts3init")           
    require("lt/events")  
    
    local registeredEvents = {
    	onTextMessageEvent = lt_events.onTextMessageEvent
    }
    
    ts3RegisterModule("lt", registeredEvents)
    events.lua
    Code:
    local function onTextMessageEvent(serverConnectionHandlerID, targetMode, toID, fromID, fromName, fromUniqueIdentifier, message, ffIgnored) 
        ts3.printMessageToCurrentTab("test")
     
    end
    
    
    lt_events = {
    	onTextMessageEvent = onTextMessageEvent	
    }
    it's on but nothing
    where is the error

  2. #2
    Join Date
    Sep 2005
    Location
    Germany / Dortmund
    Posts
    1,282
    Call your init-file "init.lua" and try again.

  3. #3
    Join Date
    Aug 2008
    Location
    Mannheim
    Posts
    16
    sry typos
    The file is called init.lua

  4. #4
    Join Date
    Sep 2005
    Location
    Germany / Dortmund
    Posts
    1,282
    The lua plugin currently does not support the onTextMessageEvent in modules.

    You can change the function in ts3events.lua to:
    Code:
    function onTextMessageEvent(serverConnectionHandlerID, targetMode, toID, fromID, fromName, fromUniqueIdentifier, message, ffIgnored)
        debugPrint("Lua: onTextMessageEvent: " .. serverConnectionHandlerID .. " " .. targetMode .. " " .. toID .. " " .. fromID .. " " .. fromName .. " " .. fromUniqueIdentifier .. " " .. message .. " " .. ffIgnored)
    for script,events in pairs(ts3RegisteredModules) do
    		if events.onTextMessageEvent ~= nil then
    			events.onTextMessageEvent(serverConnectionHandlerID, targetMode, toID, fromID, fromName, fromUniqueIdentifier, message, ffIgnored)
    		end
    	end
        return 0  -- Client will handle the chat as usual. Return 1 to let the client ignore the chat.
    end
    Then it should work. But you will do this every time your client gets updated, because the ts3events.lua gets updated as well, as long as the developers change it.


    P.S.: The return value in your function will be ignored.

  5. #5
    Join Date
    Aug 2008
    Location
    Mannheim
    Posts
    16
    yes because I had made my change but because of the updates I wanted it in a module containing
    danke

  6. #6
    Join Date
    Sep 2005
    Location
    Germany / Dortmund
    Posts
    1,282
    Yes, your module will work with that change in the ts3events.lua.

    Don't know, why this function is not implemented yet.

  7. #7
    Join Date
    Dec 2009
    Location
    Germany
    Posts
    205
    Code:
    -- TODO / FIXXED
    function onTextMessageEvent(serverConnectionHandlerID, targetMode, toID, fromID, fromName, fromUniqueIdentifier, message, ffIgnored)
        debugPrint("Lua: onTextMessageEvent: " .. serverConnectionHandlerID .. " " .. targetMode .. " " .. toID .. " " .. fromID .. " " .. fromName .. " " .. fromUniqueIdentifier .. " " .. message .. " " .. ffIgnored)
            local retValue = 0
        local ret = 0
        for script,events in pairs(ts3RegisteredModules) do
            if events.onTextMessageEvent ~= nil then
                ret = events.onTextMessageEvent(serverConnectionHandlerID, targetMode, toID, fromID, fromName, fromUniqueIdentifier, message, ffIgnored)
                if retValue == 0 then
                    retValue = ret
                end
            end
        end
        return retValue  -- Client will handle the chat as usual. Return 1 to let the client ignore the chat.
    end
    Version of this event with using return-value ov event-handlers
    downloadable within this thread

  8. #8
    Join Date
    Oct 2010
    Location
    GER
    Posts
    3
    Any info on when this event is gonna be implemented with an official release? This functionality seems quite important to me.

  9. #9
    Join Date
    Jun 2008
    Location
    Krün, Germany
    Posts
    464
    Seems I forgot to adjust onTextMessageEvent and onClientPokeEvent (see the "--TODO" comment...) when converting the event mechanism to the new autoload code. Otherwise I cannot really explain why this is missing.

    ts3events.lua will be updated.

  10. #10
    Join Date
    Jun 2008
    Location
    Krün, Germany
    Posts
    464
    For convinience, as the fix didn't make it into the current beta-35 client, I attached the adjusted Lua scripts here for those who are interested.
    Attached Files Attached Files

  11. #11
    Join Date
    Oct 2010
    Location
    GER
    Posts
    3
    Next release is fine, too, now that it's made sure that these won't be overwritten backwards on the next release when updated manually. Thanks a lot.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 21
    Last Post: 22-08-2010, 12:31
  2. Plugins LUA Questions.
    By Goluch in forum Tools
    Replies: 1
    Last Post: 30-05-2010, 17:37
  3. [Suggestion] Lua window (that doesnt require a console CMDLINE)
    By MajorThorn in forum Suggestions and Feedback
    Replies: 1
    Last Post: 11-02-2010, 18:14
  4. Replies: 3
    Last Post: 05-01-2010, 11:06
  5. Lua Question
    By Fitsch in forum Tools
    Replies: 4
    Last Post: 20-12-2009, 19:37

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •