Fix bugs

1. Fix program crashed when accessing nested table (table[key][key]).
2. Change getGlobal and printLuaRef to be inline functions.