get object name

hi sorry for my very bad English
I want to give the name of object peer position
in blender 2.53

I have writing this:


import bge

sc = bge.logic.getCurrentScene()
obj = sc.objects
li = []

for object in obj:
          if object.position[2] > -0.1 :
                li.append(object.name)

I don’t have error in my console but it don’t work and I don’t understand why

what are you doing with the list li?
are any objects above -.1?

Maybe you should add print(li) after your code

I have test the code with print(li) ^^

and yes I want to get objects with no negative z coordinate

I can’t see a problem. (Except to use worldPosition rather than position, but that makes no difference).

It is fine for me:
[‘Empty’, ‘Cube’, ‘Lamp’, ‘Camera’, ‘default__cam’]

yes i have resolved my problem

thanks