Closed hosford42 closed 7 years ago
I'll try to revisit this tomorrow to see what is causing the tests to fail. Would you prefer I leave this open or open a new one once it's good to go?
This is probably caused by wrong items on the lua virtual stack. lua_setglobal
pops one item off when called, in this case, the python 'table' got popped which normally gets returned at the end.
That said, it's probably better to not make this global by default. The suggested lua way for requiring modules is to typically assign the returned table to a variable, eg. local python = require 'python'
or python = require 'python'
if you really want it global. I think in lua 5.2+ they did away with globals and replaced it with the notion of environment space (_ENV
) instead.
Ah, that makes sense. I'm brand new to lua, and I guess I was looking at some older examples. I'll close this out, then. Thanks for the explanation!
This resolves the issue with the python global being undefined after the lib is required.