It is currently April 27th, 2024, 7:40 am

Errors on Inline Lua Examples

Report bugs with the Rainmeter application and suggest features.
RicardoTM
Posts: 268
Joined: December 28th, 2022, 9:30 pm
Location: México

Errors on Inline Lua Examples

Post by RicardoTM »

Just wanted to report errors on the Inline Lua Examples

First, on the TranslateDay lua code:

spanish = {'domingo','lunes','martes','mercredi','miércoles','viernes','sábado'},

Should be:

spanish = {'domingo','lunes','martes','miércoles','jueves','viernes','sábado'},

And the other errors are just display errors (which I haven't check exactly what the error is on the code, since I'm starting to learn lua).

TranslateDay: Header shows the literal [&MeasureScript:TranslateHeader('[#MainLang])'] string
Captura de pantalla 2024-02-15 123016.jpg
ConvertTemp: Shows the literal [&MeasureScript:ConvertToCelsius([&MeasureTemp])]°C string on MouseOver, instead (I guess it should only show "°C"), may be the weather URL it uses doesn't work anymore. Because it doesn't even show any temperature, it only displays "°F".

On Load and MouseLeave:
Captura de pantalla 2024-02-15 123620.jpg
MouseOver:
Captura de pantalla 2024-02-15 123045.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
nek
Posts: 105
Joined: November 3rd, 2019, 12:00 am

Re: Errors on Inline Lua Examples

Post by nek »

I have created a GitHub pull request #53 to the rainmeter/rainmeter-docs

I am learning Lua too.
If you have learnt the basic of Lua then learnt about Lua metatable (setmetatable(), __index),
you might be interested in the example code of Localization with Lua metatable (GitHub.com)


> Online testing for Lua code : https://onecompiler.com/lua/
RicardoTM
Posts: 268
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Errors on Inline Lua Examples

Post by RicardoTM »

nek wrote: February 16th, 2024, 2:48 am I have created a GitHub pull request #53 to the rainmeter/rainmeter-docs

I am learning Lua too.
If you have learnt the basic of Lua then learnt about Lua metatable (setmetatable(), __index),
you might be interested in the example code of Localization with Lua metatable (GitHub.com)


> Online testing for Lua code : https://onecompiler.com/lua/
Thank you, and thank you for the resources :) I'll check them out.

By the way, for your localization skin, in case you want to include the Spanish translations for:

Code: Select all

_language                       = 'Español',
_region                         = 'España',
button_ok                       = 'Aceptar',
wx_conditions_sunny		= 'Soleado',
wx_conditions_cloudy    	= 'Nublado',
wx_conditions_windy     	= 'Ventoso',
wx_conditions_rainy     	= 'Lluvioso',
menu_skin_scaling               = 'Tamaño de piel',
User avatar
nek
Posts: 105
Joined: November 3rd, 2019, 12:00 am

Re: Errors on Inline Lua Examples

Post by nek »

Thanks for the correction. I will update the code.

I don't have a good explanation in english, just a code for how Lua metatable __index works and useful.

Code: Select all

local en = { ok = 'OK', cancel = 'Cancel' }
local es = { ok = 'Aceptar' }

-- Output: nil
print(es['cancel'])

setmetatable(es, { __index = en })

-- Output: Cancel
print(es['cancel'])
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Errors on Inline Lua Examples

Post by jsmorley »

nek wrote: February 16th, 2024, 2:48 am I have created a GitHub pull request #53 to the rainmeter/rainmeter-docs

I am learning Lua too.
If you have learnt the basic of Lua then learnt about Lua metatable (setmetatable(), __index),
you might be interested in the example code of Localization with Lua metatable (GitHub.com)


> Online testing for Lua code : https://onecompiler.com/lua/
I have applied your change request. The .rmskin is updated. Thanks for the help!