Fix Python gotcha with module globals, and missing 'cond' in lslextrafuncs.

The previous commit didn't work as expected. "from module import var" freezes the value at load time; changing it later has no effect. A reference to the module needs to be used.

Fix that and the similar problem with LSO. Also revert some "from lslcommon import *" introduced earlier.

That also revealed another bug about missing 'cond' in the import list of lslextrafuncs. This should fix all functions that return values on null key input.
This commit is contained in:
Sei Lisa 2016-12-21 00:22:49 +01:00
parent 7c2c09188d
commit 991e811f2d
4 changed files with 12 additions and 10 deletions

View file

@ -20,7 +20,7 @@
# TODO: Add info to be able to propagate error position to the source.
from lslcommon import *
from lslcommon import Key, Vector, Quaternion
import lslcommon
import lslfuncs
import sys, re
@ -2621,7 +2621,7 @@ list lazy_list_set(list L, integer i, list v)
self.linestart = True
self.tok = self.GetToken()
self.globals = self.BuildTempGlobalsTable() if not IsCalc \
self.globals = self.BuildTempGlobalsTable() if not lslcommon.IsCalc \
else self.funclibrary.copy()
# Restart
@ -2636,7 +2636,7 @@ list lazy_list_set(list L, integer i, list v)
self.usedspots = 0
# Start the parsing proper
if IsCalc:
if lslcommon.IsCalc:
self.Parse_single_expression()
else:
self.Parse_script()