rewrite Python code to Lua - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: rewrite Python code to Lua (/showthread.php?tid=4745) |
rewrite Python code to Lua - Hadeel - 30.04.2023 Hi!! I am controlling an audio software with udp. Follwoing is the python code working on the site. Code: from pythonosc.udp_client import SimpleUDPClient I want to execute this from LM so I need to rewrite this in Lua. I've tried follwoing code but I got an error "invalid value (table) at index 2 in table for 'concat'". Could you help me write this code properly? Code: local socket = require("socket") Thank you very much for your help RE: rewrite Python code to Lua - admin - 02.05.2023 It's not that simple. You need a library for the OSC protocol: https://github.com/davidgranstrom/losc/ Run this script once to install the library (make sure that LM has valid gateway and DNS settings): Code: if not io.exists('/usr/share/lua/losc/') then A slight difference from the examples is that the main library should be loaded like this: Code: -- instead of local losc = require'losc' RE: rewrite Python code to Lua - Hadeel - 03.05.2023 Wow thank you admin! I never thought about that. I executed the installation script as you wrote and now I can successfully send request to Abelton. However I am having difficulties with receiving messages from Abelton. This is what I am trying on resident script with 0 interval but it seems like I'm not receiving anything. Can you tell if I'm doing something wrong? Code: local losc = require'losc.init' RE: rewrite Python code to Lua - admin - 03.05.2023 recvAddr must be your LM IP address. 127.0.0.1 is an internal address which cannot receive anything from remote hosts. You need to call osc:open() after osc:add_handler(...) RE: rewrite Python code to Lua - Hadeel - 03.05.2023 Omg it worked! I cannot describe how thankful I am! Thank you for your help even though it's about osc and abelton. Much appreciated |