small functions for lua