I want to search for all function calls in a Lua file using python. for example, I have this Lua code:
function displayText (text)
print(text)
end
sendGreetings = function(sender, reciever)
print("Hi " ..reciever.. " greetings from " ..sender.. "!")
end
displayText("Hello, World!")
sendGreetings("Roger", "Michael")
I want my python code to search for function calls in that code and returns a dictionary with the function name and parameters, so the output should be like this:
# {function_name: [param1, param2]}
{"displayText": ["Hello, World!"], "sendGreetings": ["Roger", "Michael"]}
I tried to implement it by using regex but I had all sorts of problems, and inaccurate results. Also, I don't believe there is a Lua parser for Python.