瀏覽代碼

Return nil when there are no lights

Daniele Bartolini 9 年之前
父節點
當前提交
e7645e80af
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      src/lua/lua_api.cpp

+ 7 - 1
src/lua/lua_api.cpp

@@ -1872,7 +1872,13 @@ static int render_world_light_destroy(lua_State* L)
 static int render_world_light_instances(lua_State* L)
 {
 	LuaStack stack(L);
-	stack.push_light_instance(stack.get_render_world(1)->light(stack.get_unit(2)));
+	LightInstance inst = stack.get_render_world(1)->light(stack.get_unit(2));
+
+	if (inst.i == UINT32_MAX)
+		stack.push_nil();
+	else
+		stack.push_light_instance(inst);
+
 	return 1;
 }