earthlcd / ezLCD-5x

Public Repository for ezLCD-5035-RT release files system, firmware and issue reporting
https://earthlcd.com/products/ezlcd-5x?_pos=1&_sid=0927d2260&_ss=r
0 stars 1 forks source link

Concatenate a boolean to string hangs program #58

Closed JacobChrist closed 1 year ago

JacobChrist commented 1 year ago

Describe the bug Concatenate a boolean to string hangs program

To Reproduce Steps to reproduce the behavior:

str = "text" .. true -- this hangs the program

This is the error in LuaError.log [string "ezCmdLua"]:707: attempt to concatenate a boolean value

This code works:

str = "text" .. tostring(true)

Expected behavior This may not be an issue, but I wonder if there is a more graceful way to handle this than just halting the program.

microlan commented 1 year ago

This is the expected behavior. Lua throws errors in this fashion by design (we capture it to a file when running autonomously because we won't know how to cleanly interact with a screen that the customer has modified and/or it is best to not show the enduser error messages--it is up to the customer to handle that properly/safely). If the customer traps the error in their own handler, this will be avoided. If the Lua Script is called via RUN_LUA_SD or RUN_LUA (ezLCD API Commands), the API will return the error message to the CPU that issued the command (ie, over RS232).