Artificial intelligent assistant

Dynamically loading image based on function output I'm trying to load a `.png` to display a battery icon in conky. So far I've tried nesting the function call, using eval but I can't seem to find a solution. Here is my non working conky.text: conky.text = [[ ${image ${lua battery_icon $battery_status $battery_icon}} ]] Where my `battery_icon` function looks like this: function conky_battery_icon(battery_status, battery_percent) if (battery_status == "charging") then icon = "charging-battery.png"; else ... end return("/path/to/icons/" .. icon); end I checked that the function works and I can get the correct path to the image by adding the following line to my `conky.text`: ${lua battery_icon $battery_status $battery_percent} How can I use the returned path of `battery_icon` to load the file in conky's `image`? Related question: Dynamic conky variable argument

Rather than returning the path alone, you can return a fully formed conky statement to display the icon. For example, if I have a Lua function that returns an image statement, such as...


function conky_myimg()
local path = "/home/David/System/Icons/StuffedTux.png";
local s = "${image "..path.."}";
return s;
end


...and I call the function in my `conky.text` with the line...


${lua_parse myimg}


...then the icon is displayed by conky.

![Icon displayed by conky](

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy a866b3845cfe74df768561a80b40a1d2