static void py_locals(lua_State *L) {
    PyObject *locals;

    if (lua_gettop(L) != 0) {
        lua_error(L, "invalid arguments");
    }
    locals = PyEval_GetLocals();
    if (!locals) {
        py_globals(L);
        return;
    }
    py_convert_custom(L, locals, 1);
}
Example #2
0
/**
 * Returns the locals dictionary
**/
static void py_locals(lua_State *L) {
    PyObject *locals;
    if (lua_gettop(L) != 0) {
        lua_error(L, "invalid arguments");
    }
    locals = PyEval_GetLocals();
    if (!locals) {
        py_globals(L);
        return;
    }
    Py_INCREF(locals);
    push_pyobject_container(L, locals, 1);
}