a simple example you can run now (copy and paste in the console):
var state = {count: 18}
glua.runWithGlobals({
increase: function (n) { state.count += n },
state: state
}, `
print('initial value: ', state.count)
increase(5) -- increasing by 5
`)
console.log('now the value is:', state.count)