SetGlobal pops a value from the stack and sets it as the new value of global name. http://www.lua.org/manual/5.2/manual.html#lua_setglobal
(name string)
| 1080 | // |
| 1081 | // http://www.lua.org/manual/5.2/manual.html#lua_setglobal |
| 1082 | func (l *State) SetGlobal(name string) { |
| 1083 | l.checkElementCount(1) |
| 1084 | g := l.global.registry.atInt(RegistryIndexGlobals) |
| 1085 | l.push(name) |
| 1086 | l.setTableAt(g, l.stack[l.top-1], l.stack[l.top-2]) |
| 1087 | l.top -= 2 // pop value and key |
| 1088 | } |
| 1089 | |
| 1090 | // SetTable does the equivalent of table[key]=v, where table is the value |
| 1091 | // at index, v is the value at the top of the stack and key is the value |