Functions in berry

34 views
Skip to first unread message

Ron Casorso

unread,
Feb 7, 2025, 7:52:53 PMFeb 7
to TasmotaUsers
Just wondering if anyone can point me to some docs on functions and scope within berry.  I am trying to clean up some code and would like to save some functions in a separate file.  If I load the file (containing the function) in autoexec.be (load(filename) ) I can access the function from the command line but not in a class created from main.
Thanks
Ron

Stephan Hadinger

unread,
Feb 8, 2025, 3:28:03 AMFeb 8
to Ron Casorso, TasmotaUsers
Global entities need to exist at compile time. This is true for variables and functions. 

Best way it to explicitly call out a global with:

`global.myfunc()`


Le 8 févr. 2025 à 01:52, Ron Casorso <rvca...@gmail.com> a écrit :

 Just wondering if anyone can point me to some docs on functions and scope within berry.  I am trying to clean up some code and would like to save some functions in a separate file.  If I load the file (containing the function) in autoexec.be (load(filename) ) I can access the function from the command line but not in a class created from main.
Thanks
Ron

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/sonoffusers/ema8164a85-cbd3-4d30-97c1-67d6ebf5c261%40office3.

C Barrick

unread,
Feb 13, 2025, 11:32:01 PMFeb 13
to Ron Casorso, TasmotaUsers
How's it going? Any luck? More questions?

Ron Casorso

unread,
Feb 14, 2025, 1:03:01 PMFeb 14
to C Barrick, TasmotaUsers
yes, thanks for asking.  using global.f() worked.  managed to get my fist class up and running.  
cheers
Ron
Reply all
Reply to author
Forward
0 new messages