Page 1 of 1
Underscores in function names
Posted: Wed Jan 18, 2017 9:24 pm
by Zo Kath Ra
Put this code inside a script entity:
Code: Select all
function test_me()
hudPrint("test")
end
When I point a connector at the script entity, the function doesn't show up in the connector's drop-down menu.
Is there a reason for this?
Re: Underscores in function names
Posted: Wed Jan 18, 2017 9:36 pm
by minmay
A common convention in Lua is to begin "private" function names with underscores, like "_myFunction", to imitate class encapsulation without actually enforcing it (since actually enforcing it takes some work and has a performance cost). To help with this, any function containing an underscore is not shown in the dropdown menu for connector actions. I suggest using camelCase for your function and variable names and reserving underscores for the aforementioned purpose.
Re: Underscores in function names
Posted: Thu Jan 19, 2017 3:05 am
by Isaac